我可以在列表框中插入具有特定颜色的项目吗? [英] Can I insert an item with a specific color in a Listbox?
问题描述
我正在用Excel 2013中的VBA开发应用程序.我有一个包含项目的ListBox,我想根据条件为每个项目指定特定的颜色,我在网上搜索了一下,但说这不可能那是真的吗?
I'm developing an application with VBA in Excel 2013. I have a ListBox with items and I want to give each item a specific color depending on a criteria, I searched on the net but it says that it is impossible to do so, is that true?
我尝试使用列表视图(Microsoft ListView控件),但没有显示在用户窗体中的其他控件上.
I tried to use the listview (Microsoft ListView Control) but it doesn't show on the extra controls in the userform.
有没有人知道如何根据可能的条件使用列表框为每个项目赋予特定的颜色?
Does anyone know how to do give each item a specific color depending on a criterion using a Listbox if possible?
推荐答案
您不能更改Excel列表框中单个项目的颜色.
您可以通过其他方法获得相似的结果:
There are alternative ways you can achieve a similar result:
-
使用 ActiveX ListView控件例子此处或此处
您可以动态创建HTML表并将其显示在Web浏览器控件中.
You can dynamically create an HTML Table and display that in a web browser control.
您可以操纵Excel单元格使其像列表框一样外观和 act .
You can manipulate Excel cells to look and act like a listbox.
您最好的可能是ListView控件,但可能需要花一些功夫.
Your best best might be the ListView control but it could take some fancy footwork.
MSDN: MSDN: ListView属性
这篇关于我可以在列表框中插入具有特定颜色的项目吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!