SoulA Posted August 25, 2008 Share Posted August 25, 2008 (edited) Hoping someone can point me in the right direction. Trying to add my own custom bitmap image into a listview. My test code... expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <Constants.au3> #Include <WinAPI.au3> _Main() Func _Main() Local $hImage, $hListView $school = _WinAPI_LoadImage(0, "school.bmp", $IMAGE_BITMAP, 0, 0, BitOr($LR_LOADFROMFILE, $LR_DEFAULTSIZE)) ; Create GUI GUICreate("Custom Picture", 400, 300) $hListView = GUICtrlCreateListView("", 2, 2, 394, 268) GUICtrlSetStyle($hListView, $LVS_ICON) GUISetState() ; Load images $hImage = _GUIImageList_Create() _GUIImageList_Add($hImage, $school) _GUICtrlListView_SetImageList($hListView, $hImage, 0) ; Add items _GUICtrlListView_AddItem($hListView, "Item 1", 0) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_MainoÝ÷ Øêð«Zn¶¬jëh×6#include <GuiConstantsEx.au3> #include <WinAPI.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> _Main() Func _Main() GUICreate("ImageList AddBitmap", 400, 300) $listview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($listview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)) GUISetState() ; Load images $hImage = _GUIImageList_Create(16, 32) _GUIImageList_AddBitmap($hImage, "School.bmp") _GUICtrlListView_SetImageList($listview, $hImage, 1) ; Add columns _GUICtrlListView_AddColumn($listview, "Items", 120) ; Add items _GUICtrlListView_AddItem($listview, "Item 1", 0) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main This is the .bmpSchool.bmp Edited August 25, 2008 by SoulA Link to comment Share on other sites More sharing options...
smashly Posted August 26, 2008 Share Posted August 26, 2008 (edited) Urm, renaming a file to bmp does not make it a bmp file.. The image you posted is a jpg renamed to bmp, try converting the image to a bmp properly then use the 2nd code you posted.. Also you might want to use the full path to the image your trying to load. Edit: here's the image as a bmp (not just renamed) Cheers Edited August 26, 2008 by smashly Link to comment Share on other sites More sharing options...
SoulA Posted August 26, 2008 Author Share Posted August 26, 2008 oh wow I thought I converted it in MSPaint but I guess it just got renamed thanks alot!! 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