#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>
Dim $Pic0, $Pic1
$Form1 = GUICreate("点击不同Tab显示不同图片", 633, 447, 193, 125)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
_GUICtrlTab_InsertItem($hTab, 0, "Tab 0")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 1")
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
$chage = False
While 1
If _GUICtrlTab_GetCurSel($hTab) = 0 And $chage = False Then
$chage = True
GUICtrlDelete($Pic1)
$Pic0 = GUICtrlCreatePic("0.jpg", 328, 32, 273, 201, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
EndIf
If _GUICtrlTab_GetCurSel($hTab) = 1 And $chage = True Then
$chage = False
GUICtrlDelete($Pic0)
$Pic1 = GUICtrlCreatePic("1.jpg", 328, 32, 273, 201, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
虽然同样效果
不过还是afan的代码简洁
建议楼主采纳。 |