我想把窗口上半部分的画面移掉 下半部分保持不懂
MoveWindow(hDlg, 0, -150, 480, 588, TRUE );
但是使用MoveWindow以后就把整个窗口都移动了的
怎么解决?

解决方案 »

  1.   

    把你窗口上的所有子控件上移,MoveWindow/SetWindowPos();
      

  2.   

    不行呀  一用movewindow窗口整体都移上去了的  
    我就只想移一半 另一半维持原样不动  有什么方法么?
      

  3.   

    定义两个Dialog,去掉边框(Dialog Frame 用None),然后你随便搞吧,想组合就把两个连到一块,想分开就把两个窗体拆开,想隐藏那个都行
      

  4.   

    void CTestDlg::OnButton1() 
    {
    // TODO: Add your control notification handler code here
    CString str;
    if(GetDlgItemText(IDC_BUTTON1, str), str == "收缩<<")
    {
    SetDlgItemText(IDC_BUTTON1,"扩展>>");
    }
    else
    {
    SetDlgItemText(IDC_BUTTON1,"收缩<<");
    } static CRect rectLarge;
    static CRect rectSmall;

    if(rectLarge.IsRectNull())
    {
    CRect rectSeparator;
    GetWindowRect(&rectLarge);
    GetDlgItem(IDC_SEPARATOR)->GetWindowRect(&rectSeparator); rectSmall.left=rectLarge.left;
    rectSmall.top=rectLarge.top;
    rectSmall.right=rectLarge.right;
    rectSmall.bottom=rectSeparator.bottom;
    }
    if(str=="收缩<<")
    {
    SetWindowPos(NULL,0,0,rectSmall.Width(),rectSmall.Height(),
    SWP_NOMOVE | SWP_NOZORDER);
    }
    else
    {
    SetWindowPos(NULL,0,0,rectLarge.Width(),rectLarge.Height(),
    SWP_NOMOVE | SWP_NOZORDER);
    }
    }
    从 孙鑫老师 的教程上的一段代码
      

  5.   

    SetWindowPos 把窗口高度缩小一半,然后直接ScrollWindow向上滚动原来高度的一半,子窗口也会跟着滚动。我估计应该可以。