图像组合框不起作用 [英] Image combobox is not working

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

问题描述

此代码有什么问题?

What is wrong with this code?

Private Sub Form_Load()
Dim ImageList0 As ImageList
Dim ImageCombo1 As ImageCombo
Dim objNewItem As ComboItem
Set ImageCombo1.ImageList = ImageList0 'here is the error'

Set objNewItem = ImageCombo1.ComboItems.Add(1, , "Apricot", "Apricot")
objNewItem.Indentation = 2
ImageCombo1.ComboItems("Apricot").Image = 1
ImageCombo1.ComboItems("Apricot").Image = "Apricot"
ImageCombo1.ComboItems("Apricot").SelImage = "Apricot"


结束子

我在表单上有两个组件:ImageList,其中包含填充的图像和imagecombobox,我将它们分配给imagelist.我上面的代码不起作用.请帮助提供更好的解决方案或代码.

和ImageList0是组件的名称,我没有为其分配0. Imagelist包含4张图像.


End Sub

I have two components on the form :ImageList, with populated images and imagecombobox, to which I am assigning the imagelist. My above code doesn''t work. Pls, help with the better solution or code.

and ImageList0 is the name of the component, i am not assigning 0 to it. Imagelist contains 4 images.

推荐答案

设置ImageCombo1.ImageList = ImageList0
ImageList0没什么.

为什么要分配它,然后直接将数据添加到imagecombo?首先填充列表,然后将列表分配给ImageCombo.
Set ImageCombo1.ImageList = ImageList0
ImageList0 is nothing.

Why are you assigning it and then adding data to imagecombo directly? Populate the list first and then assign the list to ImageCombo.


Sandeep,
感谢您及时的回复.我需要在窗体上使用图像组合,以便在其旁边显示图像和文本.我将ImageList active x首先放置,然后将所有图像放置在那里.然后,我试图将imalist分配给imagecombo,然后弹出错误.然后,我决定直接执行代码,但仍然没有结果.我第一次这样做,这对我的项目至关重要.你能帮我吗?请给我发送可能有效的代码.我没有使用第三方组件,而是试图使真正的Microsoft active x可以为我工作.我非常感谢您的帮助.
Hi, Sandeep,
thanks for the quick response. I need image combo on my form, so it shows images and text next to it. I put ImageList active x first and put all my images there. Then I was trying to assign imalist to imagecombo, and the error pops up. Then I decided to direct code, but still no result. I am doing this first time and this is very crucial to my project. Can you help? Pls, send me the code which might work. I am not using third parties components, i am trying to make authentic microsoft active x to work for me. i would highly appreciate your help.


添加了.object
而且有效.

谢谢大家
Added .object
and it worked.

Thanks, guys


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

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