Is there any better Solution vs. WM_PAINT

Nov 10 2010 10:02 AM

Hi :-)
I am trying to write a code which works with SetPixel to put Pixels on a Control.
I draw a picture and everything is ok. but when the area that I drew goes out of the screen it will disapear.
for solve this problem. I override the WndProc function for WM_PAINT and in this function I do the drawing again in the event.
but it is realy funny, if move the form in a way that the area is out of (or semi out of) the screen.
is there any better solution vs WM_PAINT? or maybe the way is true, my use of that maybe incorrect? :-S
protected
override void WndProc(ref Message m)
{
   base.WndProc(ref m);
   if (m.Msg == WM_PAINT)
   {
      PaintArea(
this, new EventArgs());
   }
}

Answers (5)