Sunday, July 12, 2009

Problem about pictureBox in Visual Studio C Sharp.NET ?

Hi,


I am designing a paint brush type program…..for drawing area where I can draw something then I used pictureBox…..like as


Pen p = new Pen(Color.Red, 5);


g = pictureBox2.CreateGraphics();





g.DrawEllipse(p, e.X, e.Y, 5, 7);


in this program I can draw anything but when I want to save this drawing by the help of this command: pictureBox2.Image.Save(saveFileDialog1.F...





then an error occur : “NullReferenceExpection was unhandled !”


“Object reference not set to an instance of an object.”





I need your help………can anybody solve my problem


Thanks

Problem about pictureBox in Visual Studio C Sharp.NET ?
You need to make the graphics drawn on the PictureBox to be a persistent bitmap then only you can save the image.


Use a bitmap to draw the images upon and then reflect it upon your pictureboc. When you want to save just save the bitmap.





If you want more help write to me at


addmyself@gmail.com


No comments:

Post a Comment