MFC ListView Cntrl 错误
我在模式对话框中显示 ListView cntrl,ListView 属性为“所有者绘制”和“所有者绘制固定”并使用 LVN_GETDISPINFO。当没有数据时,将显示对话框和列表视图。但奇怪的是,当我尝试将数据插入列表视图(通过将数据放入列表视图附加的数组(向量)中)时,我的对话框崩溃了。
在调试时,错误似乎来自以下 MFC 库函数:
void CListCtrl::DrawItem(LPDRAWITEMSTRUCT)
{
ASSERT(FALSE);
}
在我的其他应用程序中,我已成功显示列表控件(具有所有者绘制和所有者数据),无需子类化 CListCtrl 并覆盖 DrawItem()。但在我当前的对话框中,我无法理解为什么当我向其中插入数据时列表视图会失败?
感谢您的时间和帮助。
谢谢
I am displaying a ListView cntrl in a modal Dialog box, with ListView properties as "Owner Draw" and "Owner Draw fixed" and using LVN_GETDISPINFO. The dialog along with the list view is getting displayed when there is no data. But strangely, when I am trying to insert data into the list view (by putting data in the array (vector) attached with the list view), my dialog is crashing.
On debugging, the error seems to be coming from the following MFC Library function :
void CListCtrl::DrawItem(LPDRAWITEMSTRUCT)
{
ASSERT(FALSE);
}
In my other applications I have successfully displayed a list control (with Owner draw and Owner data), without subclassing CListCtrl, and overidding DrawItem(). But in my present dialog, I am unable to understand why the list view is failing when I am inserting data into it?
Appreciate your time and help.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当你定义Owner Draw属性时,你必须实现你自己的DrawItem函数来绘制一个项目。
您可以查找这篇文章
when you define Owner Draw property, you must implement your own DrawItem function witch draw one item.
You can look for this article