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为弹出的非模态窗口变量.效果图:
本文介绍如何创建一个非模态的设备列表窗口,并详细展示了窗口的位置调整及显示过程。通过C++代码实现了设备列表窗口的创建、初始化以及显示等功能。
1万+

被折叠的 条评论
为什么被折叠?



