Code:
CASE %WM_SIZE ' Dialog has been resized CONTROL SEND CBHNDL, %IDC_MSCTLS_STATUSBAR32_1, CBMSG, CBWPARAM, _ CBLPARAM LOCAL R AS RECT, IPart&, hStat&, hBtn&, X&,Y&,W&,H&, XOffset& IPart&=0 CONTROL SEND CBHNDL, %IDC_MSCTLS_STATUSBAR32_1, %SB_GETRECT, IPart&, VARPTR(R) CONTROL HANDLE CBHNDL, %IDC_MSCTLS_STATUSBAR32_1 TO hStat& MapWindowPoints hStat&, CBHNDL, BYVAL VARPTR(R), 2 CONTROL HANDLE CBHNDL, %IDC_BUTTON1 TO hBtn& XOffset&=72 X&=R.nLeft+GetSystemMetrics(%SM_CXEDGE) Y&=R.nTop+GetSystemMetrics(%SM_CYEDGE) W&=120 H&=(R.nBottom-R.nTop)-(2*GetSystemMetrics(%SM_CYEDGE))+1 MoveWindow hBtn&, X&+XOffset&,Y&,W&,H&,1
IPart&=0
Defines which part (or section) of the statusbar to place the button (and size it)
The line:
XOffset&=72
Defines an offset from the far left of the part (section) in pixels to place the button.
The line:
W&=120
Sets the width of the button in pixels. If you want it to fill the entire width of the part (section) of the statusbar you define in IPart& then use:
W& = (R.nLeft-R.nRight)-(2*GetSystemMetrics(%SM_CXEDGE))+1
This makes the button the entire area (aside from sunken border) of the part (section) of the statusbar defined.
Leave a comment: