总结:怎么建立无模式对话

SystemMenu ---- 改成false
可以消去Close的叉子按钮


1. 建立对话框,就像一般的

2. View里创建对象时使用
CB_dlg = new ControlBoard(this);
CB_dlg->Create(IDD_DIALOG1,NULL);
CB_dlg->ShowWindow(SW_SHOW);

3.
#define WM_FINDDATA (WM_USER+1)

View的消息队列里:
ON_MESSAGE(WM_FINDDATA,OnFindData)

long CiHairSegView::OnFindData(UINT wParam,LONG lParam){
hairManager->updateWtHt(CB_dlg->width,CB_dlg->height);
if (m_showMap) cvReleaseImage(&m_showMap);
m_showMap = hairManager->getCoverImage();
Invalidate(false);
return 0L;
}

4.
.h
CWnd* m_pParent;

.cpp
ControlBoard::ControlBoard(CWnd* pParent /*=NULL*/)
    : CDialog(ControlBoard::IDD, pParent), width(30), height(30),theta(0),omega(0),radius(0.5)
{
    ASSERT(pParent);
    m_pParent=pParent;
}

void ControlBoard::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    DDX_Text(pDX, IDC_EDIT1, width);
    DDV_MinMaxInt(pDX, width,30, 500);
    DDX_Text(pDX,IDC_EDIT2, height);
    DDV_MinMaxInt(pDX,height,30,500);
    DDX_Text(pDX,IDC_EDIT3,theta);
    DDV_MinMaxInt(pDX,theta,0,360);
    DDX_Text(pDX,IDC_EDIT5,omega);
    DDV_MinMaxInt(pDX,omega,-45,45);
    DDX_Text(pDX,IDC_EDIT4,radius);
    DDV_MinMaxFloat(pDX,radius,0.5,1.5);
}

void ControlBoard::OnBnClickedOk()
{
    if (UpdateData()){
        CWnd* pParent = m_pParent;
        pParent->SendMessage(WM_FINDDATA,0,0);
    }
}

你可能感兴趣的:(总结:怎么建立无模式对话)