在Dialog的style里,不选择"Title Bar"的话,那个对话框就不能移动了。怎样又没有标题栏,又可以移动?Thanks

解决方案 »

  1.   

    UINT CMyDlg::OnNcHitTest(CPoint point) 
    {
        UINT nHitTest=CDialog::OnNcHitTest(point);
        if(nHitTest==HTCLIENT)
            nHitTest=HTCAPTION;
        return nHitTest;
    }
      

  2.   

    void CMyDlg::OnLButtonDown(UINT nFlags, CPoint point) 
    {
        if (nFlags == MK_LBUTTON)
        {
            ReleaseCapture();//释放鼠标操作
            SendMessage(WM_NCLBUTTONDOWN, HTCAPTION, 0);
        }
        CDialog::OnLButtonDown(nFlags, point);
    }
      

  3.   

    用ClassWizrd建立一个鼠标左健选中事件 WM_LBUTTOMDOWN
    Void Dlg::OnLButtonDown(UINT nFlags, CPoint point)
    {
    SendMessage(WM_NCLBUTTONDOWN,HTCAPTION,MAKELPARA(point.x,point.y));
    }
      

  4.   

    void CTestDlg::OnLButtonDown(UINT nFlags, CPoint point) 
    {
    // TODO: Add your message handler code here and/or call default
    PostMessage( WM_NCLBUTTONDOWN, HTCAPTION, 0 ); //发送点中标题区消息
    CDialog::OnLButtonDown(nFlags, point);
    }
      

  5.   

    4 ways, wao...Which one is the most efficiency?
      

  6.   

    MAKELPARA is wrong. what is the correction?
      

  7.   

    To AloneWolf(孤狼) , where can I find OnNcHitTest in classWizard?If I just add it manually, compile is OK, but it doesn't work.
    Did you test yourself before?Thanks!