MFC简易设定通用控制窗口弹出位置

来源:互联网 发布:票据打印软件哪个好 编辑:程序博客网 时间:2024/05/16 18:55

if (NULL != _devListDlg){delete _devListDlg;}_devListDlg = new CDeviceList;_devListDlg->Create(IDD_DEVICELIST, this);_devListDlg->initDlg(CDeviceList::Proc(&CDHVisionDlg::OnConnect, this));/// 将设备列表窗口移到合适位置CRect rect, rectSelf;_devListDlg->GetClientRect(&rect);//获取Dlg客户区坐标GetClientRect(&rectSelf);this->ClientToScreen(&rectSelf);//客户区坐标转换为屏幕坐标int x = rectSelf.TopLeft().x + rectSelf.TopLeft().x / 2;int y = rectSelf.TopLeft().y + rectSelf.TopLeft().y / 2;int width = rect.Width();int height = rect.Height();_devListDlg->MoveWindow(x, y, width, height);_devListDlg->ShowWindow(SW_SHOW);
_devListDlg为弹出的非模态窗口变量.

效果图:


原创粉丝点击