Resizing Controls in MFC

前端 未结 8 1989
萌比男神i
萌比男神i 2021-01-11 10:26

I am writing a program which has two panes (via CSplitter), however I am having problems figuring out out to resize the controls in each frame. For simplicity,

8条回答
  •  遥遥无期
    2021-01-11 10:46

    When your frame receives an OnSize message it will give you the new width and height - you can simply call the CEdit SetWindowPos method passing it these values.

    Assume CMyPane is your splitter pane and it contains a CEdit you created in OnCreate called m_wndEdit:

    void CMyPane::OnSize(UINT nType, int cx, int cy)
    {
        m_wndEdit.SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
    }
    

提交回复
热议问题