函数参考


_GUICtrlListView_GetColumnOrder

检索当前列的左到右顺序,返回分隔的序号字符串.

#Include <GuiListView.au3>
_GUICtrlListView_GetColumnOrder($hWnd)

参数

$hWnd 控件句柄

返回值

成功: 返回分隔的序号字符串
失败: 返回 $LV_ERR

注意/说明

None.

相关

_GUICtrlListView_SetColumnOrder, _GUICtrlListView_SetColumnOrderArray

示例/演示


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

$Debug_LV = False ; 检查传递给 ListView 函数的类名, 设置为真并使用另一控件的句柄可以看出它是否有效

_Main()

Func _Main()
    Local $a_order, $hListView

    GUICreate("ListView Get Column Order", 400, 300)
    $hListView = GUICtrlCreateListView("Column 1|Column 2|Column 3|Column 4", 2, 2, 394, 268)
    _GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_HEADERDRAGDROP)
    _GUICtrlListView_SetColumnWidth($hListView, 0, 100)
    _GUICtrlListView_SetColumnWidth($hListView, 1, 100)
    _GUICtrlListView_SetColumnWidth($hListView, 2, 100)
    _GUICtrlListView_SetColumnWidth($hListView, 3, 100)
    GUISetState()

    _GUICtrlListView_SetColumnOrder($hListView, "3|2|0|1")

    $a_order = StringSplit(_GUICtrlListView_GetColumnOrder($hListView), "|")
    MsgBox(4160, "信息", StringFormat("Column order: [%d, %d, %d, %d]", $a_order[1], $a_order[2], $a_order[3], $a_order[4]))

    ; 循环直到用户退出
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    GUIDelete()
EndFunc   ;==>_Main