急问!!有关CFormView的问题!

magicist 2003-10-18 08:05:19
一个继承CFormView的CMyFormView,如何将它加载到对话框上??
...全文
41 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
flyelf 2003-10-31
  • 打赏
  • 举报
回复
在你的视图中添加一下代码:
在.h文件中添加声明
#ifdef _DEBUG
afx_msg int OnMouseActivate(CWnd*, UINT, UINT);
#endif

在.cpp文件中添加实现
#ifdef _DEBUG
int CYOurView::OnMouseActivate(CWnd*, UINT, UINT)
{
return MA_ACTIVATE;
}
#endif
lug626 2003-10-31
  • 打赏
  • 举报
回复
debug模式,现象为当鼠标单击激活视图时抛出异常,要不我把源程序给您看一下?
flyelf 2003-10-31
  • 打赏
  • 举报
回复
抛出什么异常了?debug or release 模式?
lug626 2003-10-31
  • 打赏
  • 举报
回复
您问题解决了吗?我现在遇到了同样的问题,用以上高手的办法总是给我跑出异常,想请问您是怎么解决的?
dhyuser10 2003-10-28
  • 打赏
  • 举报
回复
直接把对话框改成formview是否更好呢?
wuxfBrave 2003-10-20
  • 打赏
  • 举报
回复
这个应用很奇怪,不如直接用对话框好了
cauiot 2003-10-20
  • 打赏
  • 举报
回复
maoxianwang 2003-10-19
  • 打赏
  • 举报
回复
在对话框类里加一个 CYourFormView 类型的公有指变量m_pView
OnInitDialog()里
m_pView = new CYourFormView;
m_pView->Create(.........
m_pView->ShowWindow(...

flyelf 2003-10-18
  • 打赏
  • 举报
回复
下面这段代码可以在对话框上添加任何视图:
void CxxxDlg::AddObjectView(CRuntimeClass *pViewClass)
{
CCreateContext pContext;
CWnd* pFrameWnd = this;

pContext.m_pCurrentDoc = new CxxxDoc;
pContext.m_pNewViewClass = pViewClass;
CView *pView =
(CView*)((CFrameWnd*)pFrameWnd)->CreateView(&pContext);
ASSERT(pView);
pView->ShowWindow(SW_NORMAL);
m_pView = pView;
}
不过在release版本中还要注意一些问题

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧