ReferenceArticle: Bai Qiao Original: Beautification interface of VC
1. Relationship between wm_paint and wm_erasebkgnd messagesAccording to Win32 knowledge, in the message processing function of wm_paint, you must call beginpaint before painting. The beginpaint function sends the wm_erasebkgnd message (sendmessage), that is, it directly calls the message processing function to process the wm_erasebkgnd message. By default, defwindowproc processes wm_erasebkgnd and refreshes the customer area, that is, the background, which is registered in the window. Note: Of course, by calling invalidaterect (CodeGenerate wm_paint message) bool invalidaterect (hwnd, // handle to window const rect * lprect, // rectangle coordinates bool berase // erase State); to generate wm_paint message, you can specify the berase to false so that wm_erasebkgnd messages are not sent in beginpaint.
2. the following figure shows the process of beautifying the page message: wm_paint {wm_erasebkgnd // brush background {wm_ctlcolor // obtain the paint brush for the brush background, if the message is not sent, the image brush {......} registered in the window will be used by default {......}... brush background ...} wm_ctlcolor // set text-related features, such as font, foreground color, and background color... {......} // start to draw {...... // draw a specific item 1 {nm_customdraw // some properties customized by the Program )}. ..... // draw a specific item 2 {nm_customdraw // some attributes customized by the programmer {} Specific Drawing (not open )}......}}