请教:picturebox控件中自己画的简单图像如何保存
编程语言:VB.net or C#
首先在picturebox里用FillRectangle方法换一个实心矩形 Dim myBrush As New SolidBrush(System.Drawing.Color.White) Dim g As Graphics = PictureBox1.CreateGraphics g.FillRectangle(myBrush, 100, 100, 50, 50)
方法一: Dim img As Image = PictureBox1.Image img.Save("111.gif", Imaging.ImageFormat.Gif) 运行出错:未将对象引用设置到对象的实例。
方法二: 在画举行之前定义image: img = Image.FromFile("test.gif") PictureBox1.Image = img 在PictureBox1中作图后 PictureBox1.image.Save("111.gif", Imaging.ImageFormat.Gif) 运行结果:保存的图片和老图片一样
虽然问题简单,可是已经困惑我几天了,先谢了!