Previous | Index | Next 

[INFO] Forms with Line and Shape controls may exhibit a lot of flickering

IMPORTANT: this article is only relevant for Shape and Line controls generated by VB Migration Partner 1.33 or earlier versions.

Whenever a piece of code creates or removes a Shape or Line control, or changes one of its properties, all the Shape and Line controls on the same form are redrawn. The control support library implements this behavior to ensure that the background is correctly restored when a Line or Shape control is redrawn.

Forms that contain dozens of such controls – for example, forms that use Shape and Line controls to create simple animations - are subject to serious flickering issues.

Because of the nature of Shape and Line controls in VB.NET, there is no definitive solution to this flickering issue. However, you can often significantly reduce flickering problems by setting the container’s AutoRedraw property to True. This action causes all controls to be redrawn in a background image, which is later copied to the background in one operation.

Another way to reduce flickering is grouping Shape and Line controls in separate containers, for example in different PictureBox controls, so that a smaller number of lightweight controls has to be redrawn each time.

 

Previous | Index | Next