(已解决,结贴)如何获取TabSheet的点击状态
本帖最后由 feicuiboy 于 2010-6-30 19:51 编辑#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 447, 193, 125)
$Tab1 = GUICtrlCreateTab(8, 8, 305, 225)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")
GUICtrlCreateTabItem("")
$Pic1 = GUICtrlCreatePic("D:\Document And Settings2\Administrator\Desktop\1.jpg", 328, 32, 273, 201, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
想点击不同的$TabSheet1 和$TabSheet2时候显示不同图片,该怎么获取$TabSheet的点击状态 #include <GuiTab.au3>
GUICreate('点击标签切换图片', 600, 280)
$Tab1 = GUICtrlCreateTab(8, 8, 305, 225)
GUICtrlCreateTabItem("TabSheet1")
GUICtrlCreateTabItem("TabSheet2")
GUICtrlCreateTabItem("")
$Picp = RegRead('HKLM\SOFTWARE\AutoIt v3\AutoIt', 'InstallDir') & '\Examples\GUI\'
Local $p1 = $Picp & 'mslogo.jpg', $p2 = $Picp & 'logo4.gif'
$Pic = GUICtrlCreatePic($p1, 328, 32, 255, 70)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $Tab1
If _GUICtrlTab_GetCurSel($Tab1) = 0 Then GUICtrlSetImage($Pic, $p1)
If _GUICtrlTab_GetCurSel($Tab1) = 1 Then GUICtrlSetImage($Pic, $p2)
EndSwitch
WEnd #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的代码简洁
建议楼主采纳。 都挺好的。。来支持下。。 已解决,请版主结贴,谢谢 已解决,请版主结贴,谢谢
页:
[1]