HOW TO: ListView & TreeView Bitmaps WITHOUT ImageList 
Author Message
 HOW TO: ListView & TreeView Bitmaps WITHOUT ImageList

Hi to all,
I'm stuck with a code problem: I need to implement graphics in controls like
ListView and TreeView, but I absolutely don't want to use the associated
ImageList control, because of its memory problems and instability. I
packaged a DLL containing all the bitmaps I need for my apps and I would
like to use them on demand (a huge load when the app starts fills up the
entire capacity of the ImageList).

The matter is as follows:
Original project includes one form with one EMPTY ImageList control in it;
run-time procedure fills up the ImageList with bitmaps coming from a huge
DLL, via For Next cycle;

For i = 3 To cResource.LoadString(9000)
        Set img = imlBitmap16.ListImages.Add(i, , cResource.LoadBitmap(i))
Next

after that I have more than 500 images loaded and my EXE is OK in size,
which wouldn't occurr if I decided to store all the bitmaps design-time.
With this I can bind the ImageList to any ListView
cListView.SetHeaderColour ctl, True
ctl.ColumnHeaderIcons = frmBitmapForm.imlBitmap16

or TreeView,
ctl.ImageList = frmBitmapForm.imlBitmap16

or TabStrip in my project
ctl.ImageList = frmBitmapForm.imlBitmap16

But after this procedure I notice a VB memory overload message, when I try
to open a second copy of VB, or when I run another app, like Access.
So I thought about getting rid of the intrinsic ImageList to be bound to
useful controls like ListView and TreeView.
Wouldn't it be nice to use just one bitmap at a time (right the one you
need) and bind it to the control you need telling the Nodes.Add or
ListItems.Add procedures to use ID numbers from a DLL, instead of loading
all the bitmaps a project may require in an associated ImageList control?

Can anyone send me example code of how this could be achieved?
Any help is really appreciated.



Wed, 11 Feb 2004 17:02:24 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. HOW TO: ListView & TreeView Bitmaps WITHOUT ImageList

2. Imagelist, Treeview, Listview - 256 colour icons

3. TreeView/ListView bitmaps source?

4. TreeView & ImageList

5. Help with Treeview & Imagelist

6. ImageLists, TabStrips, TreeViews & MaskColours

7. Treeview & Imagelist question

8. TreeView & ImageList

9. VB4: ListView & ImageList

10. treeview & listview, slow directory listing

11. Treeview & Listview

12. Listview control & Treeview

 

 
Powered by phpBB® Forum Software