ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Shapes into List Box (https://www.excelbanter.com/excel-programming/365807-shapes-into-list-box.html)

ZipCurs

Shapes into List Box
 
I am using a List Box to control what shows up on a graph I have created and
it works. I use the List Box as the legend for the graph and have tried to
place the appropriate colored shapes next to each line item. These do not
seem to want to line up very easily. It seems to me that a better solution
would be to put the colored shape with the text in the List Box. Is this
possible? If so, some guidance would be greatly appreciated.

Jim Thomlinson

Shapes into List Box
 
List boxes only hold Text, so no I am affraid you are left to your own
devices on this one...
--
HTH...

Jim Thomlinson


"ZipCurs" wrote:

I am using a List Box to control what shows up on a graph I have created and
it works. I use the List Box as the legend for the graph and have tried to
place the appropriate colored shapes next to each line item. These do not
seem to want to line up very easily. It seems to me that a better solution
would be to put the colored shape with the text in the List Box. Is this
possible? If so, some guidance would be greatly appreciated.


Nile_Hef[_2_]

Shapes into List Box
 

Rather than drag-and-dropping an MSForms Listbox off the 'Tools' menu, click
the 'More Controls...' button and fetch two controls: a Microsoft ListView
6.0 control and an ImageList. You'll need C:\WINNT\system32\comctl32.ocx

The imageList can store small bitmaps and icons; the Listview control can
reference an ImageList and display icons alongside each entry. This needs
some VBA coding, to associate the correct ison with the correct line, but
it's a standard ActiveX interface.

Nile

ZipCurs

Shapes into List Box
 
Thanks for the suggestion, will try when time permits. Does the ListView
behave like a ListBox, allowing multiple items to be selected? Can items be
put into the ImageList from within the worksheet? All I am trying to do is
create an interactive graph legend.

"Nile_Hef" wrote:


Rather than drag-and-dropping an MSForms Listbox off the 'Tools' menu, click
the 'More Controls...' button and fetch two controls: a Microsoft ListView
6.0 control and an ImageList. You'll need C:\WINNT\system32\comctl32.ocx

The imageList can store small bitmaps and icons; the Listview control can
reference an ImageList and display icons alongside each entry. This needs
some VBA coding, to associate the correct ison with the correct line, but
it's a standard ActiveX interface.

Nile


Nile_Hef[_2_]

Shapes into List Box
 
Does the ListView behave like a ListBox, allowing multiple items to be
selected?

Yes. An MS-Forms listbox is a cut-down Listview


Can items be put into the ImageList from within the worksheet?


I'm not so sure; I've always loaded up the ImageList with the graphics I
want at design time. However, it may be possible to load the binary data from
a COM control's .Image or .Picture property at runtime.

Let me guess: you want a set of 16x16 icons representing all the possible
line formats you will use in the chart...


All times are GMT +1. The time now is 12:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com