CSplitterWnd中使用CFormView的问题
制作一个SDI程序,要分割为左右两列,第一列为普通的视图,第二列为CFormView继承过来的对话框,对话框中有些按钮,
为什么普通的视图可以创建成功,而CFormView继承过来的对话框就老是创建失败呢???
代码大概如下:
1、CFormView继承过来的对话框CTestDlg
#ifndef __AFXEXT_H__
#include <afxext.h>
#endif
class CTestDlg : public CFormView
{
protected:
CTestDlg(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CTestDlg)
.......
2、切分视图代码段
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
if (!m_split.CreateStatic(this, 1, 2)) return false;
if (!m_split.CreateView(0, 0, pContext->m_pNewViewClass,
CSize(750, 100), pContext))
return false;
if (!m_split.CreateView(0, 1, RUNTIME_CLASS(CTestDlg),
CSize(300, 100), pContext))
return false;
ShowWindow(3);
return true;
}
请高手指点啊????非常谢谢!!!
为什么普通的视图可以创建成功,而CFormView继承过来的对话框就老是创建失败呢???
代码大概如下:
1、CFormView继承过来的对话框CTestDlg
#ifndef __AFXEXT_H__
#include <afxext.h>
#endif
class CTestDlg : public CFormView
{
protected:
CTestDlg(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CTestDlg)
.......
2、切分视图代码段
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
if (!m_split.CreateStatic(this, 1, 2)) return false;
if (!m_split.CreateView(0, 0, pContext->m_pNewViewClass,
CSize(750, 100), pContext))
return false;
if (!m_split.CreateView(0, 1, RUNTIME_CLASS(CTestDlg),
CSize(300, 100), pContext))
return false;
ShowWindow(3);
return true;
}
请高手指点啊????非常谢谢!!!
...全文
相关推荐
CDockablePane类的使用.doc
CDockablePane类的使用.doc
窗体分割与CFormView
提前谢谢啦 !问题是单击ok按钮显示MessageBox对话框,显示不了!
基于SDI(单文档)多视图CFormView拆分窗口源代码
MFC,基于SDI(单文档)多视图CFormView拆分窗口源代码 你可以有一个MFC程序,不是多文档MDI,而是单文档的。 而里面需要用到拆分窗口,嵌入多个视图,这个就是源代码。
使用CSplitterWnd类分割窗口
CSplitterwnd 类——拆分窗口类,提供分离窗口的功能,使一个窗口包含多个方格。 CSplitterWnd类提供一个分隔器窗口的功能,分隔器窗口是一个包含有多个窗格的窗口。窗格通常是应用程序特定的由CView派生的对象,但它也可以是具有适当子窗口ID的任何CWnd对象。 一个CSplitterWnd对象通常被嵌入CFrameWnd或CMDIChildWnd父对象。
使用CSplitterWnd切割窗口的方法和步骤
今天使用了下CSplitterWnd这个类,在网上看了很多相关资料,但是遗憾的是绝大部分不适合初学者来学习使用,因此特别写了个简单的demo供参考,其中还有一些截图,可以让人迅速学会如何使用这个类。


