Sign in to follow this  
Followers 0
htrd

Destroy Icon created by GUICtrlSetImage()

5 posts in this topic

Hi,

 

how can I destroy an icon I created for a control by GUICtrlSetImage() ?

I want to create an icon for a ListViewItem created by GUICtrlCreateListViewItem().

This works fine by using the func G'UICtrlSetImage() on the ListViewItem handle.

Now I want the ListViewItem to be displayed without an icon. How can I do that?

I already tested with GUICtrlSendMsg() but didn't come to a working result.

 

I also tried the function posted in this thread:

 

...but this function doesn't seem to work either (at least on a ListViewItem).

 

Thanks in advance for your help guys!

Cheers htrd

Share this post


Link to post
Share on other sites



@htrd can you please post your code so we can see what you're doing? For a normal GuiCtrlSetImage I usually just set it to a blank icon, like below, but I know there are some peculiarities when you're setting the image on a TreeView or ListView item (see help file for these). If you post your full code it'll save us from trying to guess at what you're trying to do ;)

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>

GUICreate("Test")

$btnButton = GUICtrlCreateButton("", 10, 20, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 22)

$btnChange = GUICtrlCreateButton("Change Me", 300, 330, 80, 40)

GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $btnChange
            GUICtrlSetImage($btnButton, "shell32.dll", 50)
    EndSwitch
WEnd

 


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites
$aLabelSender[$i] = GUICtrlCreateListViewItem("", $LVStreams)
                        GUICtrlSetData($aLabelSender[$i], $message & "|" & $statestream & "|" & $remaining & "%")
                        GUICtrlSetFont($aLabelSender[$i], 9, 800)



If $aStreaming[$i] = 1 Then
                        If $aColor[$i] = "0x00cc33" Then
                            ;
                        Else
                            GUICtrlSetColor($aLabelSender[$i], 0x00cc33)
                            GUICtrlSetImage($aLabelSender[$i], "shell32.dll", 148)
                            $aColor[$i] = "0x00cc33"
                        EndIf
                    Else
                        If $aColor[$i] = "0x63CC00" Then
                            ;
                        Else
                            GUICtrlSetColor($aLabelSender[$i], 0x63CC00)
                            $aColor[$i] = "0x63CC00"
                            ; HERE I WANT TO REMOVE THE ICON
                        EndIf
                    EndIf

Here's a code snippet of what I do and what I want to achieve.

Share this post


Link to post
Share on other sites

Well, I thought of using an empty icon myself, I guess that works and it's a nice workaround of course, but I wanted to know if I can completely destroy the icon so that the text of the ListViewItem is left-alligned without a gap. That's just for cosmetical purposes of course.

Maybe someone has another solution to it, anyway thanks for your help JLogan3o13!

Cheers htrd

Share this post


Link to post
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
Sign in to follow this  
Followers 0