在GUI上創(chuàng)建一個(gè) TreeView 控件。
GUICtrlCreateTreeView ( 左側(cè), 上方 [, 寬度 [, 高度 [, 風(fēng)格 [, 擴(kuò)展風(fēng)格]]]] )
參數(shù)
left | 控件左側(cè)的位置。若此值為 -1 則根據(jù) GUICoordMode 的設(shè)置來計(jì)算左側(cè)位置。 |
上方 | 控件上方的位置。若此值為 -1 則根據(jù) GUICoordMode 的設(shè)置來計(jì)算上方位置。 |
寬度 | [可選參數(shù)] 控件的寬度(默認(rèn)值為上一個(gè)控件的寬度)。 |
高度 | [可選參數(shù)] 控件的高度(默認(rèn)值為上一個(gè)控件的高度)。 |
風(fēng)格 | [可選參數(shù)] 指定控件的風(fēng)格。請(qǐng)查看附錄中關(guān)于 GUI 控件風(fēng)格 的說明。 默認(rèn)值(-1):$TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS 強(qiáng)制性風(fēng)格: $WS_TABSTOP |
擴(kuò)展風(fēng)格 | [可選參數(shù)] 指定控件的擴(kuò)展風(fēng)格。請(qǐng)查看附錄的 擴(kuò)展風(fēng)格表。 |
返回值
成功: | 返回控件標(biāo)識(shí)符(控件ID)。 |
失。 | 返回值為0。 |
注意
若要設(shè)置或修改控件的各種信息請(qǐng)查看 GUICtrlSet....
相關(guān)
GUICtrlCreateTreeViewItem, GUICoordMode(選項(xiàng)), GUICtrlSet..., GUIGetMsg, GUICtrlRead
示例
#include <GUIConstants.au3>
GUICreate("我的 GUI 之 treeview",350,212)
$treeview = GUICtrlCreateTreeView (6,6,100,150,BitOr($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS),$WS_EX_CLIENTEDGE)
$generalitem = GUICtrlCreateTreeViewitem ("常規(guī)",$treeview)
$displayitem = GUICtrlCreateTreeViewitem ("顯示",$treeview)
$aboutitem = GUICtrlCreateTreeViewitem ("關(guān)于",$generalitem)
$compitem = GUICtrlCreateTreeViewitem ("計(jì)算機(jī)",$generalitem)
$useritem = GUICtrlCreateTreeViewitem ("用戶",$generalitem)
$resitem = GUICtrlCreateTreeViewitem ("分辨率",$displayitem)
$otheritem = GUICtrlCreateTreeViewitem ("其它",$displayitem)
$startlabel = GUICtrlCreateLabel ("TreeView Demo",190,90,100,20)
$aboutlabel = GUICtrlCreateLabel ("這個(gè)簡(jiǎn)單的腳本演示了 TreeView 控件的用法。",190,70,100,60)
GUICtrlSetState(-1,$GUI_HIDE)
$compinfo = GUICtrlCreateLabel ("用戶名:" & @TAB & @ComputerName & @LF & "系統(tǒng):" & @TAB & @OSVersion & @LF & "補(bǔ)。" & @TAB & @OSServicePack,120,30,200,80)
GUICtrlSetState(-1,$GUI_HIDE)
$okbutton = GUICtrlCreateButton ("確定",100,185,70,20)
$cancelbutton = GUICtrlCreateButton ("取消",180,185,70,20)
GUISetState ()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $cancelbutton Or $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $generalitem
GUIChangeItems($aboutlabel,$compinfo,$startlabel,$startlabel)
Case $msg = $aboutitem
GUICtrlSetState ($compinfo,$GUI_HIDE)
GUIChangeItems($startlabel,$startlabel,$aboutlabel,$aboutlabel)
Case $msg = $compitem
GUIChangeItems($startlabel,$aboutlabel,$compinfo,$compinfo)
EndSelect
WEnd
GUIDelete()
Exit
Func GUIChangeItems($hidestart,$hideend,$showstart,$showend)
Local $idx,$hidestart,$hideend,$showstart,$showend
For $idx = $hidestart To $hideend
GUICtrlSetState ($idx,$GUI_HIDE)
Next
For $idx = $showstart To $showend
GUICtrlSetState ($idx,$GUI_SHOW)
Next
EndFunc