Redraw/repaint a PictureBox control

  • Thread starter Thread starter Tyson Ackland
  • Start date Start date
T

Tyson Ackland

Can someone tell me how you go about handling events where your window
might be obscured and then when you bring it to the foreground, you want
your picturebox control to be repainted instead of showing large,
blocked out areas created by overlapping windows.

I have seen numerous references to onpaint etc but I haven't found an
example to follow or at least my own efforts with onpaint haven't been
fruitful as yet.
 
Tyson said:
Can someone tell me how you go about handling events where your window
might be obscured and then when you bring it to the foreground, you want
your picturebox control to be repainted instead of showing large,
blocked out areas created by overlapping windows.

I have seen numerous references to onpaint etc but I haven't found an
example to follow or at least my own efforts with onpaint haven't been
fruitful as yet.

OK I have worked out the repainting is working when resizing the window
and maximise/restoring the window. This is all happening via my Paint
handler for the PictureBox.

What is not working though is restoring from a minimised/iconified
state. The restored window does not show my PictureBox piccy. Does
anyone know what handler I need to use for this event?
 
Form_OnPaint()
Depending on the complexity of your drawing requirements, most repainting
can be done from the OnPaint event.
____________________________
The Grim Reaper
 
Tyson said:
OK I have worked out the repainting is working when resizing the window
and maximise/restoring the window. This is all happening via my Paint
handler for the PictureBox.

What is not working though is restoring from a minimised/iconified
state. The restored window does not show my PictureBox piccy. Does
anyone know what handler I need to use for this event?

Oops, I have fixed it now, looks like I had to use the argument in the
Pain event header rather than directly referencing my image variable.
 
Back
Top