检索当前列的左到右顺序,返回分隔的序号字符串.
#Include <GuiListView.au3>
_GUICtrlListView_GetColumnOrder($hWnd)
$hWnd | 控件句柄 |
成功: | 返回分隔的序号字符串 |
失败: | 返回 $LV_ERR |
#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