;给你一个参考,最笨的方法,可以优化
#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode", 1)
Local $L1,$L2,$L3,$L4,$L5,$L10,$L11,$Tab
Example()
Func Example()
Local $msg
GUICreate("My GUI Tab") ; 创建居中显示的对话框窗口
GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)
$Tab =GUICtrlCreateTab(10, 10, 200, 100)
GUICtrlSetOnEvent($Tab,"MYTab")
$L1=GUICtrlCreateLabel("标记1", 30, 80, 50, 20)
GUICtrlSetState(-1, $GUI_hide)
$L2= GUICtrlCreateLabel("标记2", 30, 80, 50, 20)
GUICtrlSetState(-1, $GUI_hide)
$L3=GUICtrlCreateLabel("标记3", 20, 130, 50, 20)
GUICtrlSetState(-1, $GUI_hide)
$L4=GUICtrlCreateLabel("标记4", 20, 140, 50, 20)
GUICtrlSetState(-1, $GUI_hide)
$L5=GUICtrlCreateLabel("标记5", 20, 150, 50, 20)
GUICtrlSetState(-1, $GUI_hide)
$L10=GUICtrlCreateLabel("标记10", 20, 200, 50, 20)
GUICtrlSetState(-1, $GUI_hide)
$L11=GUICtrlCreateLabel("标记11", 20, 210, 50, 20)
GUICtrlSetState(-1, $GUI_hide)
$OK2=GUICtrlCreateButton("OK2", 140, 50, 50)
GUICtrlSetState(-1, $GUI_hide)
$Tab0 = GUICtrlCreateTabItem("tab0")
$Tab1 = GUICtrlCreateTabItem("tab1")
$Tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateTabItem("") ; end tabitem definition
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
GUISetState(@SW_SHOW)
While 1; 运行 GUI, 直到窗口关闭
Sleep(100)
WEnd
EndFunc ;==>Example
Func MYTab()
Select
CASE GUICtrlRead($Tab)=2 ;切换到 tab2
GUICtrlSetState($L3, $GUI_HIDE)
GUICtrlSetState($L4, $GUI_HIDE)
GUICtrlSetState($L5, $GUI_HIDE)
GUICtrlSetState($L10, $GUI_SHOW)
GUICtrlSetState($L11, $GUI_SHOW)
CASE GUICtrlRead($Tab)=1 ;切换到 tab1
GUICtrlSetState($L3, $GUI_SHOW)
GUICtrlSetState($L4, $GUI_SHOW)
GUICtrlSetState($L5, $GUI_SHOW)
GUICtrlSetState($L10, $GUI_HIDE)
GUICtrlSetState($L11, $GUI_HIDE)
CASE GUICtrlRead($Tab)=0 ;切换到 tab0
GUICtrlSetState($L3, $GUI_SHOW)
GUICtrlSetState($L4, $GUI_SHOW)
GUICtrlSetState($L5, $GUI_SHOW)
GUICtrlSetState($L10, $GUI_HIDE)
GUICtrlSetState($L11, $GUI_HIDE)
EndSelect
EndFunc
Func Close()
Exit
EndFunc |