Jump to content
Sign in to follow this  

[SOLVED] Icon BACKGROUND color in listview

Recommended Posts

Hi All

I'm making good progress so far, but have an issue here.

I am adding files to my listview items from imageres.dll. When I looked at them in the resource explorer I have, it shows the icons with a white(maybe transparent) background. In my AutoIt listview, however, the icons have a BLACK background.

I also tried getting and displaying the items background color (also included below) and that hasn't helped yet either.

Any comments or suggestions are welcome!

BTW, if anyone can suggest a good(free) resource explorer, I could really use an updated one. Thanks.

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)
Local Const $ICN_QUESTION = 99
Local Const $ICN_FAIL = 100
Local Const $ICN_SUCCESS = 101

Func _Main()
    Local $listview, $hImage

    GUICreate("ImageList Create", 400, 300)
    $listview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
    _GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles)

    ; Load images
    $hImage = _GUIImageList_Create()
    _GUIImageList_AddIcon($hImage, @SystemDir & "\imageres.dll", $ICN_QUESTION)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\imageres.dll", $ICN_SUCCESS)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\imageres.dll", $ICN_FAIL)
    _GUICtrlListView_SetImageList($listview, $hImage, 1)

    ; Add columns
    _GUICtrlListView_AddColumn($listview, "Items", 120)

    ; Add items
    _GUICtrlListView_AddItem($listview, "Item 1", 0)
    _GUICtrlListView_AddItem($listview, "Item 2", 1)
    _GUICtrlListView_AddItem($listview, "Item 3", 2)

    ; Show colors
    _GUICtrlListView_SetBkColor($listview, $CLR_WHITE)
    MsgBox(4160, "Information", "Back Color ....: " & _GUICtrlListView_GetBkColor($listview) & @LF & _
            "Text Color ....: " & _GUICtrlListView_GetTextColor($listview) & @LF & _
            "Text Back Color: " & _GUICtrlListView_GetTextBkColor($listview))

    ; Loop until user exits

    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>_Main
Edited by schuc

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...