While we appreciate comments from our users, please follow our posting guidelines. Have you tried the Cyotek Forums for support from Cyotek and the community?

Styling with Markdown is supported

Original Comment


Richard Moss

# Reply


You can't stop the ImageBox from invalidating itself, if you do then it won't update at all. For example, panning or zooming will invalidate the control, even just moving another window in front of the control will cause parts of it to be repainted, that's the way Windows works. The ImageBox isn't a VB6 AutoRedraw PictureBox :)

You will need to hook into the paint chain, otherwise it's going to be impossible to keep your custom drawing available. Try to ensure that any slow code is performed only once (for example selecting an item in the List you mentioned) and then hook the Paint event and perform your custom painting on the Graphics object passed to this event. Then you can be sure that your custom code will always be executed whenever the control paints itself, regardless of what caused the control to be invalidated.

Regards; Richard Moss