📄 subject_65720.htm
字号:
<p>
序号:65720 发表者:王世刚 发表日期:2003-12-19 09:57:11
<br>主题:在mdi工程中,视图分割不成功,急需!
<br>内容:我在CChildFrame中实现分割:<BR>if (!m_splitWnd.CreateStatic(this, 1, 2))<BR> {<BR> TRACE0("Failed to Splitter window\n");<BR> return FALSE;<BR> }<BR><BR> // add the first splitter pane - the default view in column 0<BR> if (!m_splitWnd.CreateView(0, 0,<BR> RUNTIME_CLASS(CClassScoreView), CSize(150, 0), pContext))<BR> {<BR> TRACE0("Failed to create first pane\n");<BR> return FALSE;<BR> }<BR><BR> // add the second splitter pane - an input view in column 1<BR> if (!m_splitWnd.CreateView(0, 1,<BR> RUNTIME_CLASS(CLeftTreeView), CSize(0, 0), pContext))<BR> {<BR> TRACE0("Failed to create second pane\n");<BR> return FALSE;<BR> }<BR><BR> SetActiveView((CView*) m_splitWnd.GetPane(0, 1));<BR>//然后在App里调用:<BR>void CEastApp::OnAssignlession() <BR>{<BR> // TODO: Add your command handler code here<BR> CTerm term;<BR> if(term.DoModal()!=IDOK)<BR> {<BR> <BR> return;<BR> } <BR> <BR><BR> if(this->m_pDocManager==NULL||this->m_pLessionTemplate==NULL)//没有初始化文档<BR> {<BR> CMultiDocTemplate* pDocTemplate;<BR> pDocTemplate = new CMultiDocTemplate(<BR> IDR_LESSIONMENU,<BR> RUNTIME_CLASS(CEastDoc),<BR> RUNTIME_CLASS(CChildFrame), // custom MDI child frame<BR> RUNTIME_CLASS(CEastView));//CLeftTreeView<BR> AddDocTemplate(pDocTemplate);<BR> this->m_pLessionTemplate=pDocTemplate; <BR> pDocTemplate->OpenDocumentFile(NULL);<BR> }<BR> else <BR> { <BR> POSITION p=this->m_pLessionTemplate->GetFirstDocPosition();<BR> if(p)//活动文档存在<BR> {<BR> CDocument* pDoc=this->m_pLessionTemplate->GetNextDoc(p);<BR> p=pDoc->GetFirstViewPosition();<BR> if(p)//视存在<BR> {<BR> CView* pView=pDoc->GetNextView(p);<BR> pView->GetParentFrame()->BringWindowToTop();<BR> }<BR> }<BR> else<BR> {<BR> this->m_pLessionTemplate->OpenDocumentFile(NULL); <BR> }<BR> }<BR>}<BR>我跟踪到分割的那两个视图类都被加载过,但结结果就是只一个视图出来,没看见分割条,而且我也不能确定它是否就是CEastView,反正是空白。<BR> 不乔什么原因,查了很多资料也不得而知,急盼高手出手.<BR><BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:徐相华 回复日期:2003-12-19 10:02:55
<br>内容:没别的好代码,将就着
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:林建华 回复日期:2003-12-19 10:25:35
<br>内容:if (!m_splitWnd.CreateStatic(this, 1, 2))<BR> {<BR> TRACE0("Failed to Splitter window\n");<BR> return FALSE;<BR> }<BR><BR> // add the first splitter pane - the default view in column 0<BR> if (!m_splitWnd.CreateView(0, 0,<BR> RUNTIME_CLASS(CClassScoreView), CSize(150, 0), pContext))<BR> {<BR> TRACE0("Failed to create first pane\n");<BR> return FALSE;<BR> }<BR><BR> // add the second splitter pane - an input view in column 1<BR> if (!m_splitWnd.CreateView(0, 1,<BR> RUNTIME_CLASS(CLeftTreeView), CSize(0, 0), pContext))<BR> {<BR> TRACE0("Failed to create second pane\n");<BR> return FALSE;<BR> }<BR><BR> SetActiveView((CView*) m_splitWnd.GetPane(0, 1));<BR>return TRUE;//加上这句话了没?
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:王世刚 回复日期:2003-12-19 10:30:40
<br>内容:谢谢楼上的兄弟,<BR> 以前它是用的是:return CMDIChildWnd::OnCreateClient(lpcs, pContext);<BR>的确是用 return TRUE;是对的
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -