Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/24/2022 in all areas

  1. If you don't want to use a quite large UDF for just a few lines of code, here a simple way to perform what you want : #AutoIt3Wrapper_Res_File_Add=Pixel.bmp, rt_bitmap, Image, 301 #include <GUIConstants.au3> #include <GuiListView.au3> #include <Constants.au3> If Not @Compiled Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "This script needs to be compiled") Local $hGUI = GUICreate("test", 500, 500) Local $hListView = _GUICtrlListView_Create($hGUI, '', 30, 30, 300, 200) _GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_FULLROWSELECT) GUISetState() Local $hInstance = _WinAPI_GetModuleHandle(NULL) Local $hBitmap = _WinAPI_LoadImage($hInstance, "Image", $IMAGE_BITMAP , 0, 0, 0) _GUICtrlListView_SetBkHBITMAP($hListView, $hBitmap, 0, 0, 0, True) While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd ps. use BMP as it will ease your life
    1 point
  2. If you want to improve _ArrayDisplay loading speed, why not use a virtual listview. Since data isn't stored in a virtual listview, there's no loading time and the listview shows up instantly. Here an example with 1,000,000 rows and 10 columns. Run the code in SciTE with F5. #AutoIt3Wrapper_Au3Check_Parameters=-d -w- 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=Y Opt( "MustDeclareVars", 1 ) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Global $iRows = 1000000, $iCols = 10, $aArray[$iRows][$iCols] Global $hListView Example() Func Example() ; Create array Local $l, $hTimer = TimerInit() For $i = 0 To 9 For $j = 0 To $iRows / 10 - 1 $l = $i * $iRows / 10 + $j For $k = 0 To 9 $aArray[$l][$k] = 10 * $l + $k Next Next ConsoleWrite( "Rows = " & ( $i + 1 ) * $j & @CRLF ) Next ConsoleWrite( TimerDiff( $hTimer ) & @CRLF ) ; Approx. 8/11 seconds on Windows 7/10 ; Create GUI Local $hGui = GUICreate( "Virtual ListView", 788+20, 788+20 ) ; Create ListView Local $idListView = GUICtrlCreateListView( "", 10, 10, 788, 788, $LVS_OWNERDATA, $WS_EX_CLIENTEDGE ) _GUICtrlListView_SetExtendedListViewStyle( $idListView, $LVS_EX_DOUBLEBUFFER + $LVS_EX_FULLROWSELECT ) $hListView = GUICtrlGetHandle( $idListView ) For $i = 0 To $iCols - 1 _GUICtrlListView_AddColumn( $idListView, "Col" & $i, 75 ) Next GUICtrlSendMsg( $idListView, $LVM_SETITEMCOUNT, $iRows, 0 ) ; Register WM_NOTIFY message handler through subclassing Local $pNotifyHandler = DllCallbackGetPtr( DllCallbackRegister( "NotifyHandler", "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr" ) ) DllCall( "comctl32.dll", "bool", "SetWindowSubclass", "hwnd", $hGui, "ptr", $pNotifyHandler, "uint_ptr", 0, "dword_ptr", 0 ) ; $iSubclassId = 0, $pData = 0 ; Show GUI GUISetState( @SW_SHOW ) ; Loop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; Cleanup DllCall( "comctl32.dll", "bool", "RemoveWindowSubclass", "hwnd", $hGui, "ptr", $pNotifyHandler, "uint_ptr", 0 ) ; $iSubclassId = 0 GUIDelete( $hGui ) EndFunc Func NotifyHandler( $hWnd, $iMsg, $wParam, $lParam, $iSubclassId, $pData ) If $iMsg <> 0x004E Then Return DllCall( "comctl32.dll", "lresult", "DefSubclassProc", "hwnd", $hWnd, "uint", $iMsg, "wparam", $wParam, "lparam", $lParam )[0] ; 0x004E = $WM_NOTIFY Local $tNMHDR = DllStructCreate( $tagNMHDR, $lParam ) Switch HWnd( DllStructGetData( $tNMHDR, "hWndFrom" ) ) Case $hListView Switch DllStructGetData( $tNMHDR, "Code" ) Case $LVN_GETDISPINFOW Local $tNMLVDISPINFO = DllStructCreate( $tagNMLVDISPINFO, $lParam ) Local Static $tText = DllStructCreate( "wchar[50]" ), $pText = DllStructGetPtr( $tText ) DllStructSetData( $tText, 1, $aArray[DllStructGetData($tNMLVDISPINFO,"Item")][DllStructGetData($tNMLVDISPINFO,"SubItem")] ) DllStructSetData( $tNMLVDISPINFO, "Text", $pText ) Return EndSwitch EndSwitch Return DllCall( "comctl32.dll", "lresult", "DefSubclassProc", "hwnd", $hWnd, "uint", $iMsg, "wparam", $wParam, "lparam", $lParam )[0] #forceref $iSubclassId, $pData EndFunc
    1 point
×
×
  • Create New...