窗体消息模式里,GuiGetMsg 可以直接捕捉到一般鼠标按键的消息。
将9楼代码稍为转化一点就好。#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
Dim $hListView, $Form
$Form = GUICreate("ListView Set Column Width", 400, 300)
$hListView = GUICtrlCreateListView("这一列是固定列宽|Column 2|Column 3", 2, 2, 394, 268)
_GUICtrlListView_SetColumnWidth($hListView, 0, 200)
GUISetState()
While 1
Switch GUIGetMsg()
Case -3
GUIDelete($Form)
ExitLoop
Case -8 ;鼠标左键弹起
If _GUICtrlListView_GetColumnWidth($hListView, 0) <> 200 Then _GUICtrlListView_SetColumnWidth($hListView, 0, 200)
EndSwitch
WEnd
|