Image list controls and image resources

M

Mark

Hi

I notice that in some cases, to get an icon, an object (for example a list
view) uses an image list, in others (e.g. a form) the image is selected from
the project resources, i.e. a file.

As I have images that I'd like to use in both situations I would like to use
the same method for each. Preferably, as I find importing images as
resources as often as not crashes VS, I would like to work with an image
list.

Anyone know if this is possible?

Thanks in advance

Mark
PS Sorry if I completely missed something obvious...
 
C

Cor Ligthert [MVP]

Mark,

At least for me it is not clear what is the problem. Did you try it?

Cor
 
M

Mark

Hi Cor

Sorry I was a little vague... Basically there are 2 problems:

1) I would like to contain all my icons in one image list that could be used
for form icons (i.e. the one that appears in the title bar), as well as list
and tree views etc. There appears to be no image list property for forms,
the icon property being a file reference.

2) When I import icons, as resources, to use as form icons VS crashes. On
restarting it is ok and the icon is available, but its a slow crash nd a
real time waster.

I have a database which the users can assign icons to specific record types.
I would like to use these icons both when the record is displayed in a
treeview (for example) and as the forms icon when the record is opened. I
would like both situations to use the same icon without having to keep an
image list and folder full of icon resources synchronised some how.

I hope this makes sense...?

Cheers (and thanks)

Mark
 
M

Mark

Thanks again Cor (and also thanks to Herfried)

Managed to find the following (but haven't tried it yet)

Dim ico As Icon

Dim bmIcon As Bitmap = CType(ImageList1.Images(0), Bitmap)

ico = Icon.FromHandle(bmIcon.GetHicon)

Me.Icon = ico

Cheers

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top