把窗口静态分割后,想要让其中一个变成列表控件,请问如何实现?我在CMainFrame::OnCreateClient中做了如下修改:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
CRect rc;
GetClientRect(rc);
CSize panesize(rc.Width(), rc.Height() / 2);
m_wndSplitter.CreateStatic(this, 2, 1);
m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CTView), panesize, pContext);
m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CTlistView),panesize, pContext);//CTlistView是自己定义的列表类 return true;
//return CFrameWnd::OnCreateClient(lpcs, pContext);
}行不通~~~
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
CRect rc;
GetClientRect(rc);
CSize panesize(rc.Width(), rc.Height() / 2);
m_wndSplitter.CreateStatic(this, 2, 1);
m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CTView), panesize, pContext);
m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CTlistView),panesize, pContext);//CTlistView是自己定义的列表类 return true;
//return CFrameWnd::OnCreateClient(lpcs, pContext);
}行不通~~~
解决方案 »
- 滚动条显示分块的超大图片问题
- 高分请教:关于c++的随机数
- vc连接sqlserver数据库的sdk帮助在哪里啊,msdn的连接在那里??
- 如何让程序在系统启动前,启动时运行。并且让其它软件在程序执行完成后才执行
- udp使用sendto的问题,大家看看有没有遇到过
- 为什么数组定义时赋值报错?在线等
- 不用CScrollView也可以有滚动条,那有什么特别的理由用CScrollView吗?
- 有关编程实现点击另一个程序的按钮的问题
- 怎么才能让Edit Box做到只能输入整数和小数?
- ListCtrl可以实现排序功能吗?像OutLook那样!
- 主窗口上有三个子窗体,主窗体怎么知道鼠标点击了哪个子窗口?
- 询问2个智力题目
你在CTlistView里面获取CListCtrl,然后添加一点数据看看,就知道切分窗口有没有正确的显示了!
切分窗口遇到的问题。1. 用MFC新建SDI程序
2. 在MainFrm.h中添加成员变量:
protected:
CSplitterWnd m_wndSplitter;
3. 使用MFC class Wizard为CMainFrame类添加OnCreateClient函数的重载:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
m_wndSplitter.CreateStatic(this, 1, 2);
m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CTempView), CSize(200, 0), pContext);
m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CTempView), CSize(200, 0), pContext);
return true;
//return CFrameWnd::OnCreateClient(lpcs, pContext);
}
4. 在MainFrm.cpp开始处添加包含文件:
#include "TempView.h"然后出现三个错误提示,如下所示:d:\project\practice\temp\tempview.h(21) : error C2143: syntax error : missing ';' before '*'
d:\project\practice\temp\tempview.h(21) : error C2501: 'CTempDoc' : missing storage-class or type specifiers
d:\project\practice\temp\tempview.h(21) : error C2501: 'GetDocument' : missing storage-class or type specifiers
请问为什么?