Windows is a messaging system. It notifies the application by putting messages into the application message queue or sending the message to the appropriate window message handler. To display an area of the window, you can use the Windows Graphics Device Interface (GDI) function. (Such as: Textout (HDC, X, Y, PSText, Ilength);) Reaplation (including new drawing): The area where the effective area and invalid area need to be redrawn is called "invalid area", and it is not required to be called "effective area", and the information in the invalid area is stored in a "PaintStruct) 2. The device content is the data structure saved inside the GDI, which is related to a particular display device (such as a video display or printer). For video displays, the device content is always related to a particular window on the display. Some values in the device content are graphics "properties", which defines the details of the GDI drawing function. (For example, for TextOut, the property of the device content determines the color of the color, the background color, the X coordinates, and the Y coordinate image to the display area of the window, and the font used in Windows when the text is displayed.) 3. The process of redrawing: 1Windows Send a WM_PAIT message in a message queue only one WM_Paint, if there is a zone that needs to be drawn before completing the drawing, it will not be sent again, just change the contents of PaintStruct 2 acquisition device content handle (HDC) After this handle, Windows fills in the internal device content structure with the internal device content value. These default values can be changed by calling different GDI functions. The current value of these attributes can be obtained using other GDI functions. There are other GDI functions that can be truly drawing in the window display area. 3 Draw a re-drawn HDC drawing such as DrawText (HLLO, Windows 98! "), -1, & review, dt_singlex | DT_Center | DT_VCENTER); Note: You can use functions to manually get the area to be drawn, you can Use a function to change the area you want to draw to an invalid area 4 Release device content handle must appear: HDC = BeginPaint (HWND, & PS); // Acquired using GDI functions // process EndPaint (hwnd, & ps); // Release
HDC = getdc (hwnd); // Acquired using GDI functions // processing ReleaseDC (HWND, HDC); // Release