1、 Dialog *dlg=new Dialog;申明全局变量
void CImageprocessView::OnMenuitem32771() ;视类中添加了 菜单栏的消息响应函数
{
dlg->Create(IDD_DIALOG1,this);创建非模态对话框
CRect rect;
GetClientRect(&rect);//获得客户区大小
ClientToScreen( &rect ); //充满整个客户区
dlg->ShowWindow(SW_SHOW);//显示
dlg->MoveWindow(&rect);//
}
2、在OnDraw中
void CImageprocessView::OnDraw(CDC* pDC)
{
CImageprocessDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CRect rect;
GetClientRect(&rect);
ClientToScreen( &rect );
if (dlg->GetSafeHwnd())
dlg->SetWindowPos((const CWnd*)HWND_TOP,rect.left,rect.top,rect.Width(),rect.Height(),SWP_SHOWWINDOW);
}