Improvements and supplements to the article "in-depth MDI customer Window Programming" Inventec group Electronic Technology Co., Ltd. To the sea ---- I read the article "deep into MDI client Window Programming" published in your newspaper. I am very interested in this article. I think it is very good. The whole window is shown in (Omitted: ---- However, the disadvantage is that when I drag the MDI child window with the mouse, the situation shown in Figure 2 (Omitted) appears: ---- How can I erase the background? But when I minimize the entire framework window and restore it, the background of the customer window becomes normal again. How can this happen? Is there an error in vc6.0/5.0? No, this is because when we drag the MDI child window, the customer window does not reproduce the result in time. So how can we correct it? When dragging the subwindow with the mouse, we should send a message that redraws the background of the customer window to the main frame window in the current active subwindow. The onmove message processing function is added to the cchildframe using classward: Void cchildframe: onmove (int x, int y) {javasichildwnd: onmove (x, y); // addedCodeBegincmdiframewnd * p_mframe = getmdiframe (); p_mframe-> postmessage (wm_paint); // Add code end} ---- Compile and run again. The problem just now is gone. Everything is fine. No matter how you drag the MDI subwindow, the background will not be erased. ---- However, there is another problem. When I move the mouse over the border of the MDI child window and drag the border to narrow the size of the MDI child window, figure 3 appears: ---- In the same way, when the size of the MDI sub-window changes, we also need to send a re-drawing background message to the main frame window using classward to add the onsize message processing function to cchildframe as follows: Void cchildframe: onsize (uint ntype, int CX, int CY) {cmdichildwnd: onsize (ntype, CX, CY); // Add the code begincmdiframewnd * p_mframe = getmdiframe (); P _ mframe-> postmessage (wm_paint); // Add code end} ---- Re-compile and run, all of which are normal. |