In the previous article I introduced the use of Setwnd () and save (), and I'm sure you already know how to install your own widgets, and in this article I'll explain the basic methods of Tangramminictrl components, and a model of transforming the Tutorial1 dialog box program into a software.
First, let's Change the dialog box program. Because it's a framework program, so as a dialog we assume that the dialog box needs to change the size of the form, we first change the form properties, show the Main dialog Box Properties dialog box (View-> properties), in the Dialog Properties dialog box, Go to the Styles page, select resizing in the Border list, and choose Minimize box and Maximize boxes checkbox to prevent the control from blinking when it changes size, select Clip children option, and finally the following illustration shows:
After this change, the dialog box can be resized or maximized and minimized when it is run, but the Tangramminictrl component we are painting does not synchronize the size of the change, so it is necessary to respond to the main dialog box that does wm_size the message. and changes the size of the Tangramminictrl component during this message processing.
First, in response to the wm_size message, in ClassView, right-click the main dialog Class (Ctutorial1dlg) and select Add Windows message Handler in the right-click menu ... Item, in the dialog box that pops up, select Wm_size from the new Windows messages/events list on the left and double-click (same as after clicking Add handler), which automatically adds wm_size messages to the right existing Message/event the Handlers list. Then in the list on the right, double-click Wm_size Item, VC automatically go to OnSize (...) function, we add the following code here:
if (IsWindow(m_wndMiniCtrl.m_hWnd))
{
m_wndMiniCtrl.MoveWindow(0,0,cx,cy,false);
}
The final code is as follows: