Xibalba Posted October 29, 2020 Share Posted October 29, 2020 Trying to get a small padding/indent of an image, or all images, in the ListView. I'm stuck. Basically, value of Column 3, first row - the blue box - when it turns red, I want to have a margin to the left of a few pixels or similar. How? expandcollapse popup#include <GuiConstantsEx.au3> #include <ColorConstants.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> Opt("GUIOnEventMode", 1) ; GUI Local $StatusBox_Width = 800 Local $StatusBox_Height = 400 Local $hMainGUI = GUICreate("Example", $StatusBox_Width, $StatusBox_Height) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEButton") ; GUI MESSAGE LOOP GUISetState(@SW_SHOW, $hMainGUI) ; LIST VIEW Local $iListView = GUICtrlCreateListView("", 15, 40, 530, 80) _GUICtrlListView_SetExtendedListViewStyle($iListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)) ; Load images Local $hImage = _GUIImageList_Create() _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($iListView), 0xFF0000, 16, 16)) ; red _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($iListView), 0x00FF00, 16, 16)) ; green _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($iListView), 0x0000FF, 16, 16)) ; blue _GUICtrlListView_SetImageList($iListView, $hImage, 1) ; Add columns _GUICtrlListView_AddColumn($iListView, "Column 1", 80) _GUICtrlListView_AddColumn($iListView, "Column 2", 80) _GUICtrlListView_AddColumn($iListView, "Column 3", 80) _GUICtrlListView_AddColumn($iListView, "Column 4", 80) _GUICtrlListView_AddColumn($iListView, "Column 5", 80) ; Add items _GUICtrlListView_AddItem($iListView, "One") _GUICtrlListView_AddSubItem($iListView, 0, "", 1, 1) _GUICtrlListView_AddSubItem($iListView, 0, "", 2, 2) GUICtrlCreateListViewItem("1|2|3|4|5", $iListView) MsgBox($MB_SYSTEMMODAL, "Test", "Updating cell to text...") ; Update cell to text _GUICtrlListView_SetItem($iListView, "New text", 0, 2) MsgBox($MB_SYSTEMMODAL, "Test", "Updating cell to img...") ; Update cell to img _GUICtrlListView_SetItemImage($iListView, 0, 0, 2) _GUICtrlListView_SetItem($iListView, "", 0, 2) While 1 Sleep(100) ; Sleep to reduce CPU usage WEnd Func CLOSEButton() ; Note: At this point @GUI_CtrlId would equal $GUI_EVENT_CLOSE, ; and @GUI_WinHandle would equal $hMainGUI ;MsgBox(0, "GUI Event", "You selected CLOSE! Exiting...") Exit EndFunc ;==>CLOSEButton Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now