带有图像的组合框 [英] ComboBox with images

查看:86
本文介绍了带有图像的组合框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我要创建一个在同一行中具有图标和说明的组合框.该图标不在资源中(它必须是由逻辑颜色填充的矩形),因此我必须创建CImageList运行时(DrawIndirect()?).
我已经阅读了所有msdn文档(http://msdn.microsoft.com/zh-cn/library/52hkw8ts(VS.80).aspx),但是我无法填写CComboBoxEx(即使没有图标) ,而我可以填充CComboBox(使用AddString()方法).
有人可以向我解释如何创建带有图像的组合框吗?
非常感谢


...

没有人吗?

Hi everyone,
I want create a combobox having an icon and a description in the same row. The icon is not in the resource (it must be a rectangle filled by a logical color), so I must create my CImageList run-time (DrawIndirect()?).
I''ve already read all msdn documentation (http://msdn.microsoft.com/en-us/library/52hkw8ts(VS.80).aspx), but I can''t fill my CComboBoxEx (even without icons), while I can fill a CComboBox (using AddString() method).
Could someone explain me how can I create a combobox with images?
Thanks a lot


...

nobody?

推荐答案

我看到了这样的答案.是您要找的东西吗?

组合框可以使用任何对象,包括图像.
http://msdn2.microsoft.com/en-us/library/system.windows.forms.combobox.objectcollection.aspx [ ^ ]
您可以使用Items.Add方法显示图像,如下所示:
昏暗img作为新图片()
昏暗的Bimg作为新的BitmapImage(New Uri("image.jpg",UriKind.Relative))
img.Source = bimg
昏暗的项目作为新的ListBoxItem()
item.Content = img
combo.Items.Add(item)
i see such an answer. is it what you looking for?

A combobox can use any object, including images.
http://msdn2.microsoft.com/en-us/library/system.windows.forms.combobox.objectcollection.aspx[^]
You can use the Items.Add method to display an image, something like this:
Dim img As New Image()
Dim bimg As New BitmapImage(New Uri("image.jpg", UriKind.Relative) )
img.Source = bimg
Dim item As New ListBoxItem()
item.Content = img
combo.Items.Add(item)


......:sigh:............
............... :sigh: ............


这篇关于带有图像的组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆