PDA

Click to See Complete Forum and Search --> : Paint() Question/Problem


Hinder
Feb 3rd, 2003, 02:58 PM
I am having problems keeping images that I draw to a picturebox to stay put.

It appears that a Forms Paint() method erases a picturebox's contents whenever it fires.

Now I know that I can overcome this by painting to a buffer then flipping the buffer onto the Picturebox's "Image" property but I don't want to do this for performance reasons.

Is there a way to have the method that paints a Picturebox fire AFTER the main forms paint event?

MrPolite
Feb 3rd, 2003, 06:45 PM
Originally posted by Hinder
I am having problems keeping images that I draw to a picturebox to stay put.

It appears that a Forms Paint() method erases a picturebox's contents whenever it fires.

Now I know that I can overcome this by painting to a buffer then flipping the buffer onto the Picturebox's "Image" property but I don't want to do this for performance reasons.

Is there a way to have the method that paints a Picturebox fire AFTER the main forms paint event? I dont think you can change order of the events. There are only two ways that I know of: 1- put your image in picturebox.image and it wont disappear in a paint event 2- put your code in the picturebox_paint event


What is the performance issue you are talking about anyways? I know it's a little painful to get started with .net gdi :( (and will be painful even after you get started with it:D )