13.07.2015 Views

REFERENCE GUIDE

REFERENCE GUIDE

REFERENCE GUIDE

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

For more information aboutthe clipping region, see"Clipping functions," on page706.Update regionwindow processes other messages in its application queue.Postponing the WM_P AINT message lets a window process allchanges at once instead of updating bits and pieces in timeconsumingindividual steps.A window can require Windows to send a WM_P AINT messageby using the UpdateWindow function. The UpdateWindowfunction sends the message directly to the window, regardless ofthe number of other messages in the application queue.UpdateWindow is typically used when a window wants to updateits client area immediately, such as just after the window iscreated.Once a window receives a WM_P AINT message, it must call theBeginPaint function to retrieve the display context for the clientarea and to retrieve other information such as the update regionand whether the background has been erased.Windows automatically selects the update region as the clippingregion of the display context. Since GDI discards (clips) drawingthat extends outside the clipping region, only drawing that is inthe update region is actually visible.The BeginPaint function empties the update region to prevent thesame region from generating subsequent WM_P AINT messages.After completing the painting operation, the window must callthe EndPaint function to release the display context.An update region defines the part of the client area that is markedfor painting on the next WM_P AINT message. The purpose of theupdate region is to save some applications the time it takes topaint the entire contents of the client area. If only the part thatneeds painting is added to the update region, only that part ispainted. For example, if a word changes in the client area of aword-processing application, only the word needs to be painted,not the entire line of text. This saves the time it takes theapplication to draw the text, especially if there are many differentsizes and typefaces.The InvalidateRect and InvalidateRgn functions add a givenrectangle or region to the update region. The rectangle or regionmust be given in client coordinates. The update region itself isdefined in client coordinates. Windows adds its own rectanglesChapter 7, Window manager interface functions 51

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!