我的一个程序在主程序界面上按一个按钮后会弹出一个无模对话框我想让弹出的窗体的上部挨着主窗体的下部(类似winmap那种)应该怎么做?还有setwindow 和movewindows 如何使用啊

解决方案 »

  1.   

    CRect rect;
    GetWindowRect(&rect);
    CRect rect1;
    rect1.left=rect.left+100;
    rect1.top=rect.top-100;
    rect1.right=rect.right;
    rect1.bottom=rect.bottom ;
    this->MoveWindow(rect1,true);
      

  2.   

    Pipi0714 你采用硬定位是不行的
    应该这样
    为你的子对话框做一个派生自CDialog的类
    然后在映射ON_INITDIALOG,在OnInitDialog中添加

    CRect rect;
    AfxGetMainWnd()->GetWindowRect(&rect);
    rect.OffsetRect(0,rect.Height());
    MoveWindow(rect,true);
    就行了。
      

  3.   

    在OnInitDialog()中加入如下语句:     
             CRect rectdlg;
    CRect rect;
    AfxGetMainWnd()->GetWindowRect(&rect);
    GetWindowRect(&rectdlg);
    MoveWindow(CRect(rect.left,rect.bottom,rect.right,(rect.bottom+rectdlg.Height())),TRUE);