请教如何控制对话框尺寸?

解决方案 »

  1.   

    通过WM_SIZE消息可以得到尺寸使用MoveWindow或setwondowspos来设定窗口大小
      

  2.   

    限制窗口大小
    // 最大最小尺寸的象素点 - 示例
    #define MINX 200
    #define MINY 300
    #define MAXX 300
    #define MAXY 400void C***::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
    {
     CRect rectWindow;
     GetWindowRect(&rectWindow); CRect rectClient;
     GetClientRect(&rectClient); // get offset of toolbars, scrollbars, etc.
     int nWidthOffset = rectWindow.Width() - rectClient.Width();
     int nHeightOffset = rectWindow.Height() - rectClient.Height(); lpMMI->ptMinTrackSize.x = MINX + nWidthOffset;
     lpMMI->ptMinTrackSize.y = MINY + nHeightOffset;
     lpMMI->ptMaxTrackSize.x = MAXX + nWidthOffset;
     lpMMI->ptMaxTrackSize.y = MAXY + nHeightOffset;
    }
      

  3.   

    MoveWindow或SetWindowsPos来设定窗口大小