How to position the controls in a view?
-
Hi, I have 2 very basic questions about MFC. 1. How can I position a control in a view from the program (not using resource editor), for example in a TreeView, I want to position the treecontrol starting from (0, rect.height()/18) coordinate. 2. If I resize the parent window how can I have the controls resize themselves? (which function in the view to be changed?) Please help
-
Hi, I have 2 very basic questions about MFC. 1. How can I position a control in a view from the program (not using resource editor), for example in a TreeView, I want to position the treecontrol starting from (0, rect.height()/18) coordinate. 2. If I resize the parent window how can I have the controls resize themselves? (which function in the view to be changed?) Please help
1.You can use CWnd::SetWindowPos to set the position of a window. 2. I would use CWnd::OnSize in the parent class. The framework calls this member function after the window’s size has changed. Change the size of the child windows is in this method. You will find details about the mthods in the MSDN library.
-
1.You can use CWnd::SetWindowPos to set the position of a window. 2. I would use CWnd::OnSize in the parent class. The framework calls this member function after the window’s size has changed. Change the size of the child windows is in this method. You will find details about the mthods in the MSDN library.
Thanks for yur reply. I tried to use following the function as follows, but, I can't see the tree in the view, I'm sure it's under the control on top of it which occupying the 1/18 height from top. Please help CTreeCtrl& tree = GetTreeCtrl(); tree.SetWindowPos (&cMyTabCtrl, 0, cr.Height()/18, cr.Width(), cr.Height()*17/18, SWP_DRAWFRAME);
-
Hi, I have 2 very basic questions about MFC. 1. How can I position a control in a view from the program (not using resource editor), for example in a TreeView, I want to position the treecontrol starting from (0, rect.height()/18) coordinate. 2. If I resize the parent window how can I have the controls resize themselves? (which function in the view to be changed?) Please help
Hi, You also can try to use MoveWindow insted SetWindowPos. May be it will solve your problems. Vitali http://www.creative-case.com[^]