点击客户区,创建非模态对话框,马上可以移动这个对话框

来源:互联网 发布:单片机控制220v继电器 编辑:程序博客网 时间:2024/06/05 00:42
void CMainFrame::OnLButtonDown(UINT nFlags, CPoint point) 
{// 点击客户区
// TODO: Add your message handler code here and/or call default
if(IsWindow(m_Dlg.m_hWnd)) m_Dlg.DestroyWindow();
//  创建非模态对话框
m_Dlg.Create(IDD_DIALOG1);
//  马上可以移动这个对话框
CRect rc;
m_Dlg.GetWindowRect(&rc);
CPoint pt=point;
// ClientToScreen(&pt);// only in view;
m_Dlg.MoveWindow(pt.x-10,pt.y-10,rc.Width(),rc.Height());
m_Dlg.ShowWindow(SW_SHOW);
m_Dlg.SendMessage(WM_SYSCOMMAND,0xF012,0);
//
CFrameWnd::OnLButtonDown(nFlags, point);
}
0 0