如何在对话框中使用视类?
在MDI或SDI的一个应用中,单击某个菜单弹出一个模式对话框A,我想在A中,实现自用绘画功能?
如何使对话框支持视图啊!!!!
问题点数:50、回复次数:4Top
1 楼pomelowu(羽战士)回复于 2004-12-01 19:42:34 得分 10
http://www.codeguru.com/Cpp/W-D/dislog/article.php/c5009/
http://www.codeguru.com/Cpp/W-D/dislog/article.php/c5007/Top
2 楼I_Love_CPP(Never stop!)回复于 2004-12-01 21:31:22 得分 10
给你个最简单的:
OnInitDialog()
{
CCreateContext ctx1;
ctx1.m_pCurrentDoc = NULL;
ctx1.m_pCurrentFrame = NULL;
ctx1.m_pLastView = NULL;
ctx1.m_pNewDocTemplate = NULL;
ctx1.m_pNewViewClass = RUNTIME_CLASS(CMyView);//CMyView是自己定义的视类
CMyView *m_pview = (CMyView *)((CFrameWnd *)this)->CreateView(&ctx1);
CRect rectClient;
GetDlgItem(IDC_STATIC22)->GetClientRect(rectClient);
GetDlgItem(IDC_STATIC22)->MapWindowPoints(this, rectClient);
rectClient.DeflateRect(0,0);
m_pview->MoveWindow(rectClient);
m_pview->UpdateWindow();
}
Top
3 楼wave2050(hello word)回复于 2004-12-01 23:14:37 得分 0
同意,在静态文本中也可以画呀!Top
4 楼laiyiling(陌生人[MVP])回复于 2004-12-06 07:01:56 得分 30
CMainFrame *pMain=(CMainFrame *)AfxGetApp()->m_pMainWnd;
CClientView *pView=(CClientView *)pMain->GetActiveView();
pView->....//访问视图的函数Top




