Jump to content
Sign in to follow this  

_GUIImageList_Add problem

Recommended Posts


As you can see in the following code, I can't seem to stretch the bitmap image to fill the entire column (Col2). Firstly, is this at all possible and secondly, if not, what's the purpose of the sizes in the function _GUICtrlListView_CreateSolidBitMap ?

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

Opt('MustDeclareVars', 1)

$Debug_LV = False; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work


Func _Main()
    Local $hImage, $hListView
    GUICreate("ListView Create Solid BitMap", 400, 300)
    $hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
    _GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_SUBITEMIMAGES)

; Load images
    $hImage = _GUIImageList_Create()
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF00FF, 16, 250))
    _GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
    _GUICtrlListView_AddColumn($hListView, "Col1", 100)
    _GUICtrlListView_AddColumn($hListView, "Col2", 250)
; Add items
    _GUICtrlListView_AddItem($hListView, "Item 1", 0)
    _GUICtrlListView_AddItem($hListView, "Item 2", 1)
    _GUICtrlListView_AddItem($hListView, "Item 3", 2)
    _GUICtrlListView_AddSubItem($hListView, 0, "solid color here the width of the column", 1, 3)

; Loop until user exits
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc  ;==>_Main

Share this post

Link to post
Share on other sites

Inherited from _WinAPI_CreateSolidBitmap which is what the function calls for you.

I had a play around with _WinAPI_CreateSolidBitmap but still couldn't get it to fill an entire cell so I assume by that you mean it won't work because it's an inherited feature. In that case, is there anyway I can get a "graphic" to fill an entire cell? Would a stretched icon work do you think?

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.