如何在CListCtrl中显示不同尺寸的图像
在我的MFC程序中,我想在列表中显示不同大小的图像! 我使用CListCtrl和CImageList! 但CImageList只能加载固定图像!
In my MFC program,I want to display different size images in a list!
I use CListCtrl and CImageList!
But the CImageList only can load fixed images!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不支持 CListCtrl 中的可变行高。您可以看一下 这篇文章,它描述了一个基于 CWnd 的控件处理可变行高的绘制。
Variable row heights in CListCtrl is not supported. You could take a look at this article that describes a control based on CWnd that handles drawing of variable row heights.
我会考虑使用所谓的“所有者绘制”模式自己绘制这些。我不知道另一种选择(没有内置模式)...也许您也可以采用最大尺寸并将较小的图像放入较大的框架中,但我认为这将是相同的工作并且效率较低...
我的意思是使用
CListCtrl::DrawItem()
方法
I would consider to use the so called "owner drawn" mode to draw these myself. I don't know about another option (there is no built-in mode)... Maybe you can also take the biggest size and fit the smaller images into the bigger frames but I think it will be the same effort and be less efficient...
I mean use the
CListCtrl::DrawItem()
method
在对话框或表单上创建一个“网格”,很可能是一个非对称网格。然后根据您的选择用不规则形状的图像填充它。如果您需要更多空间,请查看可滚动“任何”视图、对话框等。
< strong>不规则或非矩形位图似乎是一个不错的起点。
Create a "grid," a non-symmetrical grid most likely, on a dialog or Form. Then populate it with irregular shaped images as you choose. If you need more space look into a Scrollable “whatever,” view, dialog, etc.
Irregular or non rectangular shaped bitmaps seems a good place to start.