关于CCtrlview的问题

fietiger 2006-11-15 12:28:55
看了下面的文章后想比照他做一个结果怎么都不成功。
http://www.codeguru.com/cpp/w-d/doc_view/controlviews/article.php/c3259/
文中是这样说的
(Note: I used the standard ListBox control here since that can be tested by everyone. You can easily apply these same rules to your own custom CWnd-derived classes as well.)
可是我从CListBox 派生了一个类叫CPropertyList结果就不行,好像是类名的关系,可是我试着重载CListBox 的creat函数,结果还是不行。请高手指点。在下谢过了!
...全文
139 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
laolaoliu2002 2006-11-15
  • 打赏
  • 举报
回复
Testing this class is as easy as writing it. Simply follow these steps :

Use the AppWizard to create an SDI application called LbxViewTest
Add the ListBoxView.cpp and ListBoxView.h files from above to your new project
Open the LbxViewTestView.h file and include the ListBoxView.h file
Replace all occurrences of CView with CListBoxView
Open the LbxViewTestView.cpp file and replace all occurrences of CView with CListBoxView
Add the view's OnInitialUpdate member function as follows:
void CLbxViewTestView::OnInitialUpdate()
{
CListBoxView::OnInitialUpdate();

CListBox* pLbx = (CListBox*)this;
if (pLbx)
{
CString str;
for (int i = 0; i < 10; i++)
{
str.Format("Test %ld", i);
pLbx->AddString(str);
}
}
}

laolaoliu2002 2006-11-15
  • 打赏
  • 举报
回复
看看
zhouyan024 2006-11-15
  • 打赏
  • 举报
回复
打不开网页,好慢啊

15,979

社区成员

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

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