In other words, the Windows SDK does not seem to provide an API for setting the size of the customer zone in a window.
Setwindowpos and movewindow can only set the size of the entire window.
You cannot directly set the size of the customer zone. Setting the size of the customer zone is not helpful,
For example, when performing text output computing on the customer area.
Windows window consists of several parts, including the customer, non-customer area, getwindowrect can
Obtains the size of the entire window. getclientrect can be used to obtain the size of the customer. It is important to know that
The size of the customer zone, which can be obtained through getsystemmetrics, is relative to the method below.
It must be complex. Here is my solution:
0) variable definition
Rect rcwindow;-> size of the entire window
Rect rcclient;-> customer zone size
Int borderwidth, borderheight;-> non-customer size
1) Get the size of the entire window through getwindowrect
Getwindowrect (hwnd, & rcwindow );
2) Get the size of the customer's rectangle through getclientrect
Getclientrect (hwnd, & rcclient );
3) subtract the two to obtain the non-customer size.
Borderwidth = (rcwindow. right-rcWindow.left)
-(Rcclient. right-rcClient.left );
Borderheight = (rcwindow. bottom-rcWindow.top)
-(Rcclient. bottom-rcClient.top );
4) use setwindowpos/movewindow to reset the window size
Setwindowpos (hwnd, 0, boderwidth + width of the new customer zone,
Boderheight + new customer height, swp_nomove | swp_nozorder );
Conclusion:
This method cleverly avoids calling system functions to calculate non-customer sizes,
Besides, before calling the API, you need to know the composition of non-customers. This is too complicated.
It is unclear.
Girl don't cry (QQ: 191035066) @ 2013-03-21 23:45:22 http://www.cnblogs.com/nbsofer