本帖最后由 kk_lee69 于 2018-3-29 22:56 编辑
如何禁止使用者 调整 LISTVIEW的某一列的列宽??
从官网找到一个 禁止使用者 调整 LISTVIEW 的列宽范例,无奈本身对于消息不熟,不能改成只禁止某一列的列宽被调整,抛砖引玉,看看有没有高手能够帮忙改一下,我想要限制只禁止某一列的列宽被调整
#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)
;Global Const $WM_NOTIFY = 0x004E
Global Const $HDN_FIRST = -300
Global Const $HDN_ITEMCHANGINGA = $HDN_FIRST - 0
Global Const $HDN_ITEMCHANGINGW = $HDN_FIRST - 20
$GUI = GUICreate("Static Columns Demo!", 420, 240)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
$ListView = GUICtrlCreateListView("Column1|Column2", 20, 20, 380, 200, $LVS_NOSORTHEADER)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY_EVENTS")
GUICtrlCreateListViewItem("Item 1|SubItem 1", $ListView)
GUICtrlCreateListViewItem("Item 2|SubItem 2", $ListView)
GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 0, 80)
GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 1, 80)
GUISetState(@SW_SHOW)
While 1
Sleep(100)
WEnd
Func Quit()
Exit
EndFunc
Func WM_NOTIFY_EVENTS($hWndGUI, $MsgID, $wParam, $lParam)
Local $TagNMHDR = DllStructCreate("int;int;int", $lParam)
If @error Then Return
Local $iEvent = DllStructGetData($TagNMHDR, 3)
If $iEvent = $HDN_ITEMCHANGINGA Or $iEvent = $HDN_ITEMCHANGINGW Then Return 1
Return $GUI_RUNDEFMSG
EndFunc
|