Info 1 Posted July 22, 2010 #Include <GuiListView.au3> #Include <GuiImageList.au3> $g = GUICreate("") $hList = _GUICtrlListView_Create($g, "",2,2, 200, 200, BitOR($lvs_icon, $lvs_list)) $hImage = _GUIImageList_Create() _GUIImageList_AddIcon($hImage, "myicon.ico") _GUICtrlListView_SetImageList($hList, $hImage) _GUICtrlListView_AddItem($hList, "Item", 0) GUISetState() While 1 If GUIGetMsg() = -3 Then Exit WEnd what am I doing wrong? Share this post Link to post Share on other sites
KaFu 295 Posted July 22, 2010 The $iType parameter for _GUICtrlListView_SetImageList() does not seem to be as optional as I thought ... #include <GuiListView.au3> #include <GuiImageList.au3> $g = GUICreate("") $hList = _GUICtrlListView_Create($g, "", 2, 2, 200, 200, BitOR($lvs_icon, $lvs_list)) $hImage = _GUIImageList_Create(16, 16, 5, 3, 1) ConsoleWrite($hImage & @CRLF) $res = _GUIImageList_AddIcon($hImage, @ScriptDir & "\myicon.ico") ConsoleWrite($res & @CRLF) $res = _GUICtrlListView_SetImageList($hList, $hImage,1) ConsoleWrite($res & @CRLF) $res = _GUICtrlListView_AddItem($hList, "Item", 0) ConsoleWrite($res & @CRLF) GUISetState() While 1 If GUIGetMsg() = -3 Then Exit WEnd OS: Win10-1909 - 64bit - German, AutoIt Version: 3.3.14.5, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2019-Dec-21) BIC - Batch-Image-Cropper (2019-Dec-11) COP - Color Picker (2009-May-21) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2019-Dec-07) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Share this post Link to post Share on other sites
Info 1 Posted July 22, 2010 (edited) awesome, thanks One more question, how can I increase the size of the listview items? I used to use GUICtrlSetFont() on ListBox controls but it doesn't seem to work with ListViews Edited July 22, 2010 by Info Share this post Link to post Share on other sites
KaFu 295 Posted July 22, 2010 Thats easy ... expandcollapse popup#region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=n #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GuiListView.au3> #include <GuiImageList.au3> #include <Winapi.au3> #include <FontConstants.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> $h_Report_ListView_Font = _WinAPI_CreateFont(30, 0, 0, 0, 600, False, False, False, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, _ $CLIP_DEFAULT_PRECIS, $PROOF_QUALITY, 0, "Tahoma") OnAutoItExitRegister("_OnAutoItExitRegister") Func _OnAutoItExitRegister() _WinAPI_DeleteObject($h_Report_ListView_Font) EndFunc $g = GUICreate("") $hList = _GUICtrlListView_Create($g, "", 2, 2, 200, 200, BitOR($lvs_icon, $lvs_list)) $hImage = _GUIImageList_Create(16, 16, 5, 3, 1) $res = _GUIImageList_AddIcon($hImage, @ScriptDir & "\myicon.ico") $res = _GUICtrlListView_SetImageList($hList, $hImage, 1) $res = _GUICtrlListView_AddItem($hList, "Item", 0) GUIRegisterMsg($WM_NOTIFY, "My_WM_NOTIFY") GUISetState() While 1 If GUIGetMsg() = -3 Then Exit WEnd Func My_WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hList Switch $iCode Case $NM_CUSTOMDRAW Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $ilParam) Switch DllStructGetData($tCustDraw, "dwDrawStage") Case $CDDS_PREPAINT Return $CDRF_NOTIFYITEMDRAW ;request custom drawing of items EndSwitch Local $hDC = DllStructGetData($tCustDraw, 'hdc') _WinAPI_SelectObject($hDC, $h_Report_ListView_Font) Return $CDRF_NEWFONT EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>My_WM_NOTIFY OS: Win10-1909 - 64bit - German, AutoIt Version: 3.3.14.5, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2019-Dec-21) BIC - Batch-Image-Cropper (2019-Dec-11) COP - Color Picker (2009-May-21) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2019-Dec-07) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Share this post Link to post Share on other sites