Jump to content

Gui pic from GUIImageList


Jewtus
 Share

Recommended Posts

I have a Tree view and I'm trying to build a legend for it. This is the code I use for the imagelist:

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 14)
_GUIImageList_AddIcon($hImage, "shell32.dll", 18)
_GUIImageList_AddIcon($hImage, "shell32.dll", 17)
_GUIImageList_AddIcon($hImage, "shell32.dll", 28)
_GUIImageList_AddIcon($hImage, "shell32.dll", 9)
_GUIImageList_AddIcon($hImage, "shell32.dll", 8)
_GUICtrlTreeView_SetNormalImageList($idTreeView_1, $hImage)

I'm trying to make it so in my legend, I call the same image list so I don't need to change multiple file references to change the images. I've tried both of these:

$Pic1 = GUICtrlCreatePic("", 464, 80, 28, 28)
GUICtrlSetImage(-1, $hImage, 0)
$Pic2 = GUICtrlCreatePic("", 464, 112, 28, 28)
GUICtrlSetImage($hImage, "shell32.dll", 18) ; syntax from Add child

Anyone have an idea on what I need to do to achieve this?

EDIT: I noticed that I was using Pic instead of icon. I swapped it for icon and now the icons show up, but its still not set to a variable that allows me to control both at once.

Edited by Jewtus
Link to comment
Share on other sites

I also noticed something that I don't think is documented in the UDF (or maybe my use of shell32.dll as a file is an issue).
 
This is the code for my image list:

$idTreeView_1 = GUICtrlCreateTreeView(15, 45, 442, 278, -1, $WS_EX_CLIENTEDGE)
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 18)
_GUICtrlTreeView_SetNormalImageList($idTreeView_1, $hImage)
$hParentDomain = _GUICtrlTreeView_Add( $hTreeView_1, $hParentDomain, $domains[$z],0,0)

This is my code for the Legend/Key:

$Pic1 = GUICtrlCreateIcon("shell32.dll", 18, 464, 80, 28, 28)

The images are different even though they call out the same index. The Index for Imagelist is base 0 where the index for CreateIcon is base 1

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...