函数参考


_GUICtrlListView_DrawDragImage

绘制拖动图像

#Include <GuiListView.au3>
_GUICtrlListView_DrawDragImage(ByRef $hWnd, ByRef $aDrag)

参数

$hWnd 控件句柄
$aDrag 如下格式数组:
[0] - 拖动图像列表句柄
[1] - 图像左上角的 X 坐标
2] - 图像左上角的 Y 坐标

返回值

None.

注意/说明

None.

相关

_GUICtrlListView_CreateDragImage

示例/演示


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

$Debug_LV = False ; 检查传递给 ListView 函数的类名, 设置为True并输出到一个控件的句柄,用于检查它是否工作

Example_UDF_Created()

Func Example_UDF_Created()

    Local $GUI, $hImage, $aDrag, $hListView

    $GUI = GUICreate("(UDF Created) ListView Draw Drag Image", 400, 300)

    $hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268)
    GUISetState()

    ; 加载图像
    $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)

    ; 添加列
    _GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
    _GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
    _GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

    ; 添加项目
    _GUICtrlListView_AddItem($hListView, "Red", 0)
    _GUICtrlListView_AddItem($hListView, "Green", 1)
    _GUICtrlListView_AddItem($hListView, "Blue", 2)

    ; 创建拖动时的图像
    $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