Sign in to follow this  
Followers 0
schuc

[SOLVED] Icon BACKGROUND color in listview

3 posts in this topic

#1 ·  Posted (edited)

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
_Main()

Func _Main()
    Local $listview, $hImage
    Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)

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


    ; 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

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
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  
Followers 0