How can I resize a frame with controls (static, sliders, edit)?
After capturing WM_SIZE message I'll have to move and stretch some controls, how can I do that?
There are a few ways to do this, and of course it all depends on what needs to be resized. Do you have a button you want to keep in the same place, an edit box you want to stretch to the end of the dialog, or a tree ctrl you want to enlarge to take advantage of extra room? I any case I'll give you this to get started. Here is how you would make an edit box longer when the window gets bigger.
void CMyDialog::OnSize(UINT nType, int cx, int cy)
{
CMyDialog::OnSize(nType, cx, cy);
CEdit* pEdit = (CEdit*)GetDlgItem(IDC_MYEDIT_CONTROL);
//move right edge of edit box 10 from the border
ctrlRect.right = winRect.right - 10;
pEdit->MoveWindow(ctrlRect, TRUE);
}
}
This should get you started into more complex resizing stuff. All resizing code will use these functions, it's just how you mess with the rects to get the desired results. Good Luck.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.