[ACCEPTED]-How can you bring a control to front in mfc-mfc
In Visual Studio 6.0 do the following.
Open the dialog screen (in designer view)
Press 5 Ctrl + D
The tab orders will be shown for 4 each control
Start clicking controls in the 3 tab order you expect to see in run-time 2 (ie., the control on which you click first 1 will have tab order set to 1 and so on...)
I think the control in front will be the 12 last control that occurs in the rc file. In 11 other words, the dialog editor will draw 10 each control as it is encountered from top 9 to bottom in the rc file, overlapping them 8 when necessary.
You can edit the rc file 7 to reorder them, or you can change the tab 6 order in the editor, which does the same 5 thing since tab order is also set based 4 on the order that the controls occur in 3 the file. To my knowledge MFC doesn't offer 2 any other way of layering overlapping controls 1 at design time.
GetDlgItem(IDC_MYCONTROL)->SetWindowPos(HWND_TOP,
0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE);
0
Actually, if you want to do this in the 4 resource editor, you can just cut the item 3 and then paste it back as a quick and dirty 2 solution. Just Ctrl-X then Ctrl-V.
Editing 1 the RC file will also work.
You can use CWnd::SetWindowPos() to control the Z order of your 2 controls, without changing their position 1 in the parent window.
In the MSVC 2005 dialog resource editor there is 5 an option to set the tab order. In MSVC 2005 it is 4 found on the Format, Tab Order menu.
The tab order displayed 3 by this menu option is the same order in 2 which the controls are written to the resource 1 file.
GetDlgItem(IDC_CONTROL1)->SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE)
0
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.