resizing a group box control during runtime
-
I would like to resize a group box control during run-time (for instance in the OnInitDialog function). I only need to change it's height (make it smaller). How can I do this? I tried the following (which didn't work..): CRect rect; GetDlgItem(IDC_STATIC_GRP_SEARCH)->GetClientRect(rect); rect.SetRect(11,280,66,280); rect.DeflateRect(0,0,0,rect.Height()-50); SetRect did not work so I tried using DeflateRect - and that also did not work. Please help...
-
I would like to resize a group box control during run-time (for instance in the OnInitDialog function). I only need to change it's height (make it smaller). How can I do this? I tried the following (which didn't work..): CRect rect; GetDlgItem(IDC_STATIC_GRP_SEARCH)->GetClientRect(rect); rect.SetRect(11,280,66,280); rect.DeflateRect(0,0,0,rect.Height()-50); SetRect did not work so I tried using DeflateRect - and that also did not work. Please help...
You're changing a
RECT
, but you still need to change the size of the control.SetWindowPos()
will do that.--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Dunder-Mifflin, this is Pam.
-
I would like to resize a group box control during run-time (for instance in the OnInitDialog function). I only need to change it's height (make it smaller). How can I do this? I tried the following (which didn't work..): CRect rect; GetDlgItem(IDC_STATIC_GRP_SEARCH)->GetClientRect(rect); rect.SetRect(11,280,66,280); rect.DeflateRect(0,0,0,rect.Height()-50); SetRect did not work so I tried using DeflateRect - and that also did not work. Please help...
-
I would like to resize a group box control during run-time (for instance in the OnInitDialog function). I only need to change it's height (make it smaller). How can I do this? I tried the following (which didn't work..): CRect rect; GetDlgItem(IDC_STATIC_GRP_SEARCH)->GetClientRect(rect); rect.SetRect(11,280,66,280); rect.DeflateRect(0,0,0,rect.Height()-50); SetRect did not work so I tried using DeflateRect - and that also did not work. Please help...
I don't understand - do I have to call setRect and afterwards call setWindowPos or MoveWindow, or do I not need to call setRect? I tried adding a call to setWindowPos as following: CRect rect; GetDlgItem(IDC_STATIC_GRP_SEARCH)->GetClientRect(rect); rect.SetRect(11,280,66,280); MoveWindow(11,280,198,66); but it just ends up changing the size of the whole dialog and not the control itself.... if you could please write an example of the code it would be very helpful.
-
I don't understand - do I have to call setRect and afterwards call setWindowPos or MoveWindow, or do I not need to call setRect? I tried adding a call to setWindowPos as following: CRect rect; GetDlgItem(IDC_STATIC_GRP_SEARCH)->GetClientRect(rect); rect.SetRect(11,280,66,280); MoveWindow(11,280,198,66); but it just ends up changing the size of the whole dialog and not the control itself.... if you could please write an example of the code it would be very helpful.
Even no need to the get the client rect in your case; this is because you specify absolute coordinates; I mean not depending on the current position of the control.
//CRect rect;
//GetDlgItem(IDC_STATIC_GRP_SEARCH)->GetClientRect(rect);
//rect.SetRect(11,280,66,280);GetDlgItem(IDC_STATIC_GRP_SEARCH)->MoveWindow(11,280,198,66);
-- ===== Arman