Jump to content

Recommended Posts

Posted

The example from the helpfile slightly modified to fit your params works nice on my XP
You should show the whole code

#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiListView.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Example()

Func Example()
    Local $idListview, $hImage
    Local $iStylesEx = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)

    GUICreate("ImageList Create", 400, 300)
    $idListview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
    _GUICtrlListView_SetExtendedListViewStyle($idListview, $iStylesEx)
    GUISetState(@SW_SHOW)

    ; Load images
    $hImage =  _GUIImageList_Create(48,48,5,1) 

    _GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($idListview), 0xFF0000, 48,48))
    _GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($idListview), 0x00FF00, 48,48))
    _GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($idListview), 0x0000FF, 48,48))
    _GUICtrlListView_SetImageList($idListview, $hImage, 1)

    ; Add columns
    _GUICtrlListView_AddColumn($idListview, "Items", 120)

    ; Add items
    _GUICtrlListView_AddItem($idListview, "Item 1", 0)
    _GUICtrlListView_AddItem($idListview, "Item 2", 1)
    _GUICtrlListView_AddItem($idListview, "Item 3", 2)

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

 

Posted

...mmmm try my code please THX

$hImage = _GUIImageList_Create(48,48,5,1)
        _GDIPlus_Startup()
        $aArrays = IniReadSectionNames($gini)
            If Not @error Then
                For $i = 1 To $aArrays[0]
                    $n = IniRead($gini,$aArrays[$i],"name","")
                    $z=IniRead($gini,$aArrays[$i], "icon", "")
                    ;load icon and upscale the icon to 48x48 pixels
                    $hBitmap = _GDIPlus_BitmapCreateFromFile($z)
                    $hBitmap_scaled = _GDIPlus_ImageResize($hBitmap, 48, 48)
                    $hBitmap_GDI = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap_scaled)
                    _GDIPlus_BitmapDispose($hBitmap_scaled)
                    _GDIPlus_BitmapDispose($hBitmap)
                    $ico = _GUIImageList_Add($hImage, $hBitmap_GDI)
                    _GUICtrlListView_SetImageList($hListView, $hImage, 1)
                    _GUICtrlListView_AddItem($hListView, $n,$ico)
                    _GUICtrlListView_AddSubItem($hListView,$i-1,$aArrays[$i],1)
                    _GUICtrlStatusBar_SetText($hStatus, "Total "&$i)
                     $tot = $i
                Next
                _GUICtrlListView_SortItems($hListView, 0)
                    SoundPlay($finish)
                    _WinAPI_DeleteObject($hBitmap_GDI)
                    _GDIPlus_Shutdown()
            EndIf

 

Posted

rootx,
How can you expect a precise answer when posting only a non runnable piece of code ?
Anyway this works for me :

#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiListView.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
Example()

Func Example()
    Local $idListview, $hImage
    Local $iStylesEx = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)

    GUICreate("ImageList Create", 400, 300)
    $idListview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
    _GUICtrlListView_SetExtendedListViewStyle($idListview, $iStylesEx)
    GUISetState(@SW_SHOW)

    ; Load images
    $hImage =  _GUIImageList_Create(48,48,5,1) 
                   _GDIPlus_Startup()
                    $hBitmap = _GDIPlus_BitmapCreateFromFile(@scriptdir & "\A.ico") ; a valid 32x32 .ico
                    $hBitmap_scaled = _GDIPlus_ImageResize($hBitmap, 48, 48)
                    $hBitmap_GDI = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap_scaled)
                    _GDIPlus_BitmapDispose($hBitmap_scaled)
                    _GDIPlus_BitmapDispose($hBitmap)
                    _GDIPlus_Shutdown()
    _GUIImageList_Add($hImage, $hBitmap_GDI)
    _GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($idListview), 0x00FF00, 48,48))
    _GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($idListview), 0x0000FF, 48,48))
    _GUICtrlListView_SetImageList($idListview, $hImage, 1)

    ; Add columns
    _GUICtrlListView_AddColumn($idListview, "Items", 120)

    ; Add items
    _GUICtrlListView_AddItem($idListview, "Item 1", 0)
    _GUICtrlListView_AddItem($idListview, "Item 2", 1)
    _GUICtrlListView_AddItem($idListview, "Item 3", 2)
 _WinAPI_DeleteObject($hBitmap_GDI)

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

 

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
×
×
  • Create New...