Draw the Drag Image
#include <GuiListView.au3>
_GUICtrlListView_DrawDragImage ( ByRef $hWnd, ByRef $aDrag )
$hWnd | Handle to the control |
$aDrag | Array with the following format: [0] - Handle to the drag image list [1] - X coordinate of the upper left corner of the image [2] - Y coordinate of the upper left corner of the image |
Creates a drag image from an image list.
_GUICtrlListView_CreateDragImage
#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiListView.au3>
Example_UDF_Created()
Func Example_UDF_Created()
Local $hGUI, $hImage, $aDrag, $hListView
$hGUI = GUICreate("(UDF Created) ListView Draw Drag Image", 400, 300)
$hListView = _GUICtrlListView_Create($hGUI, "", 2, 2, 394, 268)
GUISetState(@SW_SHOW)
; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)
; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)
; Add items
_GUICtrlListView_AddItem($hListView, "Red", 0)
_GUICtrlListView_AddItem($hListView, "Green", 1)
_GUICtrlListView_AddItem($hListView, "Blue", 2)
; Create drag image
$aDrag = _GUICtrlListView_CreateDragImage($hListView, 0)
_GUICtrlListView_DrawDragImage($hListView, $aDrag)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_MOUSEMOVE
_GUICtrlListView_DrawDragImage($hListView, $aDrag)
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
; Destory image list
_GUIImageList_Destroy($aDrag[0])
GUIDelete()
EndFunc ;==>Example_UDF_Created