Previous | Index | Next 

[PRB] Manually invoking the Paint event handler may not deliver the expected results

Under VB6, a method that works as the handler for the Paint event – e.g. the Form_Paint handler – can be also invoked manually to force the execution of a series of graphic methods.

This technique doesn’t work correctly in migrated project when double buffering is being used, because in this case the support library hasn’t prepared the drawing surface for those graphic methods.

The solution to this issue is quite simple: instead of manually invoking the Paint event handler, you indirectly fire the control’s Paint event by means of the Refresh or Invalidate methods that all .NET controls expose.

 

Previous | Index | Next