Microsoft® .NET Compact Framework (Core Reference)
by Andy Wigley, Stephen Wheelwright, Robert Burbidge, Rory MacLoed, Mark Sutton
The OnPaint Method
The OnPaint method for a form or a control is called by the operating system whenever part or all of that form or control is obscured by another form or control and needs to be redrawn. A Graphics object is passed as part of the PaintEventArgs parameter for the OnPaint method. Using this Graphics object, you redraw the portion of the display that has been obscured. You use the ClipRectangle property, which defines a Rectangle structure that represents the area of the display that has been obscured, to test whether you need to redraw your graphics. Testing the ClipRectangle before redrawing your graphics reduces unnecessary processing of commands.
Note
Note that the Paint event handler for a form or a control, such as Form1_Paint ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access