nyke0 Posted August 26, 2014 Posted August 26, 2014 Hey, i tried to add an own icon (not from windows) in my listview, but it didnt worked expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> _Main() Func _Main() Local $hGui, $listview, $hImage Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES) $hGui = GUICreate("ImageList: Icon hinzufügen", 400, 300) $listview = _GUICtrlListView_Create($hGui, "", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles) GUISetState() ; Lädt die Bilder $hImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_AddIcon($hImage, @ScriptDir & "\cross.ico",0) _GUIImageList_AddIcon($hImage, @ScriptDir & "\cross.ico", 1) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 168) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 137) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 146) _GUICtrlListView_SetImageList($listview, $hImage, 1) ; Fügt die Spalten hinzu _GUICtrlListView_AddColumn($listview, "Spalte 1", 120) _GUICtrlListView_AddColumn($listview, "Spalte 2", 120) _GUICtrlListView_AddColumn($listview, "Spalte 3", 120) ; Fügt die Items hinzu _GUICtrlListView_AddItem($listview, "Zeile 1: Spalte 1", 0) _GUICtrlListView_AddSubItem($listview, 0, "Zeile 1: Spalte 2", 1, 1) _GUICtrlListView_AddSubItem($listview, 0, "Zeile 1: Spalte 3", 2, 2) _GUICtrlListView_AddItem($listview, "Zeile 2: Spalte 1", 1) _GUICtrlListView_AddSubItem($listview, 1, "Zeile 2: Spalte 2", 1, 2) _GUICtrlListView_AddItem($listview, "Zeile 3: Spalte 1", 2) _GUICtrlListView_AddItem($listview, "Zeile 4: Spalte 1", 3) _GUICtrlListView_AddItem($listview, "Zeile 5: Spalte 1", 4) _GUICtrlListView_AddSubItem($listview, 4, "Zeile 5: Spalte 2", 1, 3) _GUICtrlListView_AddItem($listview, "Zeile 6: Spalte 1", 5) _GUICtrlListView_AddSubItem($listview, 5, "Zeile 6: Spalte 2", 1, 4) _GUICtrlListView_AddSubItem($listview, 5, "Zeile 6: Spalte 3", 2, 3) ; Die Schleife wiederholt sich, bis der Benutzer die Beenden-Aktion der GUI auslöst Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main
BrewManNH Posted August 27, 2014 Posted August 27, 2014 Seeing as how the Windows icons appear to be working, it might be a problem with your icon files. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! Reveal hidden contents I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
kylomas Posted August 27, 2014 Posted August 27, 2014 nyke0, This is working for me... expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> _Main() Func _Main() Local $hGui, $listview, $hImage Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES) $hGui = GUICreate("ImageList: Icon hinzufügen", 400, 300) $listview = _GUICtrlListView_Create($hGui, "", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles) GUISetState() ; Lädt die Bilder $hImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_AddIcon($hImage, @ScriptDir & "\r-icon.ico",0) _GUIImageList_AddIcon($hImage, @ScriptDir & "\s_icon.ico",0) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 168) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 137) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 146) _GUICtrlListView_SetImageList($listview, $hImage, 1) ; Fügt die Spalten hinzu _GUICtrlListView_AddColumn($listview, "Spalte 1", 120) _GUICtrlListView_AddColumn($listview, "Spalte 2", 120) _GUICtrlListView_AddColumn($listview, "Spalte 3", 120) ; Fügt die Items hinzu _GUICtrlListView_AddItem($listview, "Zeile 1: Spalte 1", 0) _GUICtrlListView_AddSubItem($listview, 0, "Zeile 1: Spalte 2", 1, 1) _GUICtrlListView_AddSubItem($listview, 0, "Zeile 1: Spalte 3", 2, 2) _GUICtrlListView_AddItem($listview, "Zeile 2: Spalte 1", 1) _GUICtrlListView_AddSubItem($listview, 1, "Zeile 2: Spalte 2", 1, 2) _GUICtrlListView_AddItem($listview, "Zeile 3: Spalte 1", 2) _GUICtrlListView_AddItem($listview, "Zeile 4: Spalte 1", 3) _GUICtrlListView_AddItem($listview, "Zeile 5: Spalte 1", 4) _GUICtrlListView_AddSubItem($listview, 4, "Zeile 5: Spalte 2", 1, 3) _GUICtrlListView_AddItem($listview, "Zeile 6: Spalte 1", 5) _GUICtrlListView_AddSubItem($listview, 5, "Zeile 6: Spalte 2", 1, 4) _GUICtrlListView_AddSubItem($listview, 5, "Zeile 6: Spalte 3", 2, 3) ; Die Schleife wiederholt sich, bis der Benutzer die Beenden-Aktion der GUI auslöst Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Using these icon files : R-icon.ico and s_icon.ico kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
BrewManNH Posted August 27, 2014 Posted August 27, 2014 On 8/27/2014 at 3:13 AM, nyke0 said: win icons work I'm aware that they work, that wasn't the point of what I posted. The point was, there might be a problem with YOUR icon files, you should post them. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! Reveal hidden contents I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
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