|
-
Oct 31st, 2000, 11:31 PM
#1
Thread Starter
New Member
Thanks to these forums I now know how to extract and display an icon from a given file, and place it in a picture box. However, how can I get that same icon into an ImageList and therefore use it in a ListView (ie. Like a list of files with the correct icon in the listview.)
Any help would be much appreciated.
Thanks in advance.
Stu.
-
Nov 1st, 2000, 03:30 AM
#2
Extract the icon and paint to a picture box and make it persistent by assigning the image property to the picture property.
Then use the Add method of the ListImages collection.
Code:
Static iIconCount As Integer
'code to extract and paint an icon
'to the picIcon PictureBox goes here
picIcon.Picture = picIcon.Image
iIconCount = iIconCount + 1
With imlIcons
'the following two properties can
'be set during design time
.MaskColor = picIcon.BackColor
.UseMaskColor = True
.ListImages.Add , "Icon" & iIconCount, picIcon.Picture
End With
The iIconCount in the above example is only there so we can give the icon a unique key in the ListImages collection.
Good luck!
-
Nov 1st, 2000, 04:27 PM
#3
Thread Starter
New Member
Extrating Icons
Great, thanks.
It was the use of Image property I was missing. It now works nicely and my list views have meaningful icons.
Thanks again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|