Managed C++ and .NET Development: Visual Studio .NET 2003 Edition
What is this Invalidate() method and why was it called? The Invalidate() method is the manual way of triggering a Paint event. Thus, in the previous example, because you no longer draw the coordinate information to the screen in the MouseDown handler, you need to trigger the Paint event using the Invalidate() method.
Calling the Invalidate() method without any parameters, as shown in the preceding example, tells the form that its entire client area needs updating. The Invalidate() method also can take parameters. These parameters allow the Invalidate() method to specify that only a piece of the client area within the control needs to be updated. You will look at this type of the Invalidate() method in GDI+ optimization later in the chapter.
Категории