找回密码
 加入
搜索
查看: 5464|回复: 25

[AU3基础] 昨晚搞到晚12点,没有搞出来,求大侠写哈(已解决)

 火.. [复制链接]
发表于 2018-3-16 07:16:10 | 显示全部楼层 |阅读模式
本帖最后由 qsy666888 于 2018-3-17 15:37 编辑

昨晚搞到晚12点,没有搞出来,求大侠写一下,想点击第一个按钮的时候显示第一个按钮标签1和2,点击第二个按钮的时候显示第二个按钮标签1和2,昨晚弄了会出现很多标签,没有搞成功。








本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2018-3-16 09:11:52 | 显示全部楼层
默认第一个tab是显示状态,第二个为隐藏状态。按下第二个按钮的时候,第一个tab隐藏,第二个显示不是也可以吗~~
发表于 2018-3-16 09:14:11 | 显示全部楼层
回复 1# qsy666888
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 437, 192, 124)
$Button1 = GUICtrlCreateButton("第一按钮", 512, 64, 75, 25)
$Button2 = GUICtrlCreateButton("第二按钮", 512, 120, 75, 25)
$Form2 = GUICreate("", 417, 305, 14, 28, $WS_POPUP, $WS_EX_MDICHILD, $Form1)
$Tab1 = GUICtrlCreateTab(24, 48, 417, 305)
$TabSheet1 = GUICtrlCreateTabItem("第一个按钮标签1")
$Label1 = GUICtrlCreateLabel("Label1", 80, 96, 36, 17)
$Input1 = GUICtrlCreateInput("Input1", 48, 128, 121, 21)
$Input2 = GUICtrlCreateInput("Input2", 48, 152, 121, 21)
$Combo1 = GUICtrlCreateCombo("Combo1", 48, 184, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Date1 = GUICtrlCreateDate("2018/03/16 06:51:11", 48, 208, 186, 21)
$Group1 = GUICtrlCreateGroup("Group1", 216, 96, 185, 105)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button3 = GUICtrlCreateButton("Button3", 72, 248, 75, 25)
$TabSheet2 = GUICtrlCreateTabItem("第一按钮标签2")
GUICtrlSetState(-1,$GUI_SHOW)
$Label2 = GUICtrlCreateLabel("Label2", 96, 88, 36, 17)
$Group2 = GUICtrlCreateGroup("Group2", 208, 104, 185, 105)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Input3 = GUICtrlCreateInput("Input3", 56, 152, 121, 21)
$Input4 = GUICtrlCreateInput("Input4", 56, 176, 121, 21)
$Combo2 = GUICtrlCreateCombo("Combo2", 56, 200, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Date2 = GUICtrlCreateDate("2018/03/16 06:52:54", 48, 224, 186, 21)
$Button4 = GUICtrlCreateButton("Button4", 80, 264, 75, 25)
GUICtrlCreateTabItem("")

$Form3 = GUICreate("", 417, 305, 14, 28, $WS_POPUP, $WS_EX_MDICHILD, $Form1)
$Tab2 = GUICtrlCreateTab(24, 48, 417, 305)
$TabSheet3 = GUICtrlCreateTabItem("第二个按钮标签1")
$Label3 = GUICtrlCreateLabel("Label1", 80, 96, 36, 17)
$Input5 = GUICtrlCreateInput("Input1", 48, 128, 121, 21)
$Input6 = GUICtrlCreateInput("Input2", 48, 152, 121, 21)
$Combo3 = GUICtrlCreateCombo("Combo1", 48, 184, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Date3 = GUICtrlCreateDate("2018/03/16 06:51:11", 48, 208, 186, 21)
$Group3 = GUICtrlCreateGroup("Group1", 216, 96, 185, 105)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button5 = GUICtrlCreateButton("Button3", 72, 248, 75, 25)
$TabSheet4 = GUICtrlCreateTabItem("第二按钮标签2")
GUICtrlSetState(-1,$GUI_SHOW)
$Group2 = GUICtrlCreateGroup("Group2", 224, 80, 185, 41)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button6 = GUICtrlCreateButton("Button4", 40, 88, 75, 25)
$Button7 = GUICtrlCreateButton("Button5", 120, 88, 75, 25)
$ListView1 = GUICtrlCreateListView("", 32, 128, 250, 150)
$TreeView1 = GUICtrlCreateTreeView(288, 128, 113, 209)
GUICtrlCreateTabItem("")

GUISetState(@SW_HIDE, $Form2)
GUISetState(@SW_SHOW, $Form1)
GUISetState(@SW_SHOW, $Form3)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit  
                Case $Button1
                        GUISetState(@SW_SHOW, $Form2)
                        GUISetState(@SW_HIDE, $Form3)
                Case $Button2
                        GUISetState(@SW_SHOW, $Form3)
                        GUISetState(@SW_HIDE, $Form2)
        EndSwitch
WEnd
发表于 2018-3-16 09:16:09 | 显示全部楼层
回复 1# qsy666888

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 437, 192, 124)
$Button1 = GUICtrlCreateButton("菴珨偌聽", 512, 64, 75, 25)
$Button2 = GUICtrlCreateButton("菴媼偌聽", 512, 120, 75, 25)
$Tab1 = GUICtrlCreateTab(24, 48, 417, 305)
$TabSheet1 = GUICtrlCreateTabItem("Button1")
$Label1 = GUICtrlCreateLabel("Label1", 80, 96, 36, 17)
$Input1 = GUICtrlCreateInput("Input1", 48, 128, 121, 21)
$Input2 = GUICtrlCreateInput("Input2", 48, 152, 121, 21)
$Combo1 = GUICtrlCreateCombo("Combo1", 48, 184, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Date1 = GUICtrlCreateDate("2018/03/16 06:51:11", 48, 208, 186, 21)
$Group1 = GUICtrlCreateGroup("Group1", 216, 96, 185, 105)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button3 = GUICtrlCreateButton("Button3", 72, 248, 75, 25)
$TabSheet2 = GUICtrlCreateTabItem("button2")
GUICtrlSetState(-1,$GUI_SHOW)
$Label2 = GUICtrlCreateLabel("Label2", 96, 88, 36, 17)
$Group2 = GUICtrlCreateGroup("Group2", 208, 104, 185, 105)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Input3 = GUICtrlCreateInput("Input3", 56, 152, 121, 21)
$Input4 = GUICtrlCreateInput("Input4", 56, 176, 121, 21)
$Combo2 = GUICtrlCreateCombo("Combo2", 56, 200, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Date2 = GUICtrlCreateDate("2018/03/16 06:52:54", 48, 224, 186, 21)
$Button4 = GUICtrlCreateButton("Button4", 80, 264, 75, 25)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                
                case $Button1
                        GUICtrlSendMsg($Tab1, 4912,  0   , 0)
                case $Button2
                        GUICtrlSendMsg($Tab1, 4912,  1   , 0)

        EndSwitch
WEnd
 楼主| 发表于 2018-3-16 09:16:53 | 显示全部楼层
回复 3# austere


    谢谢大侠谢谢大侠
 楼主| 发表于 2018-3-16 09:26:15 | 显示全部楼层
本帖最后由 qsy666888 于 2018-3-16 09:27 编辑

回复 3# austere

发现标题成灰色了
 楼主| 发表于 2018-3-16 09:30:34 | 显示全部楼层
回复 4# kk_lee69

不是你这样的,是点击按钮一的时候显示左边的两个标签页,点击按钮二的时候显示另外两个标签页,在同一窗口下
发表于 2018-3-16 10:05:09 | 显示全部楼层
回复 7# qsy666888


  发现标题成灰色了,如果这个对你要求很重要,就按照 2楼说的那样, 我是嫌一个一个隐藏你的控件太麻烦,所以才用的窗口~
 楼主| 发表于 2018-3-16 10:09:21 | 显示全部楼层
回复 8# austere
隐藏不了,你简单做一个看看,可以吗
发表于 2018-3-16 11:07:44 | 显示全部楼层
本帖最后由 xzf680 于 2018-3-16 11:13 编辑

看看是不是你想要的效果

#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <GuiTab.au3>
#include <ComboConstants.au3>


$Form1 = GUICreate("Form1", 615, 438, -1, -1)

;左边按钮
$Button1 = GUICtrlCreateButton("第一按钮", 512, 64, 75, 25)
$Button2 = GUICtrlCreateButton("第二按钮", 512, 120, 75, 25)

;左边背景色
GUICtrlCreateGraphic(445,0,170,438)
GUICtrlSetBkColor(-1, 0x304040)
;右边背景色
GUICtrlCreateGraphic(0, 0, 445, 438)
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlSetState(-1,128)

;选项卡
$Tab1 = GUICtrlCreateTab(0, -4, 448, 444,$TCS_FIXEDWIDTH)
_GUICtrlTab_SetItemSize(-1, 1, 1)

$TabSheet1 = GUICtrlCreateTabItem("说明")
$Label1 = GUICtrlCreateLabel("Label1", 80, 96, 36, 17)
$Input1 = GUICtrlCreateInput("Input1", 48, 128, 121, 21)
$Input2 = GUICtrlCreateInput("Input2", 48, 152, 121, 21)
$Combo1 = GUICtrlCreateCombo("Combo1", 48, 184, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Date1 = GUICtrlCreateDate("2018/03/16 06:51:11", 48, 208, 186, 21)
$Group1 = GUICtrlCreateGroup("Group1", 216, 96, 185, 105)
$Button3 = GUICtrlCreateButton("Button3", 72, 248, 75, 25)
GUICtrlCreateTabItem("")
;--------------------------------------------------------
$TabSheet2 = GUICtrlCreateTabItem("VERTICAL")
$Label2 = GUICtrlCreateLabel("Label2", 96, 88, 36, 17)
$Group2 = GUICtrlCreateGroup("Group2", 208, 104, 185, 105)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Input3 = GUICtrlCreateInput("Input3", 56, 152, 121, 21)
$Input4 = GUICtrlCreateInput("Input4", 56, 176, 121, 21)
$Combo2 = GUICtrlCreateCombo("Combo2", 56, 200, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Date2 = GUICtrlCreateDate("2018/03/16 06:52:54", 48, 224, 186, 21)
$Button4 = GUICtrlCreateButton("Button4", 80, 264, 75, 25)
GUICtrlCreateTabItem("")


GUISetState(@SW_SHOW)

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        _GUICtrlTab_SetCurFocus ($Tab1,0);        如果标签控件没有 $TCS_BUTTONS 样式, 改变焦点也同时改变选定的标签.
                Case $Button2
                        _GUICtrlTab_SetCurFocus ($Tab1,1)

        EndSwitch
WEnd

评分

参与人数 1金钱 +10 收起 理由
xyhqqaa + 10

查看全部评分

发表于 2018-3-16 11:14:45 | 显示全部楼层
留個腳印  MacGyver
 楼主| 发表于 2018-3-16 12:46:10 | 显示全部楼层
本帖最后由 qsy666888 于 2018-3-16 12:49 编辑

回复 10# xzf680

不是你这种,要像三楼那种,三楼大侠那个还有点美中不足的是标题是灰色,还有就是如果窗口最大化,会影响界面,看起不美观,就是不知道隐藏TabItem标签是哪个代码
发表于 2018-3-16 13:42:57 | 显示全部楼层
回复 12# qsy666888
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <GuiTab.au3>



#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 437, -1, -1)

$Button1 = GUICtrlCreateButton("第一按钮", 512, 64, 75, 25)
$Button2 = GUICtrlCreateButton("第二按钮", 512, 120, 75, 25)

$Tab1 = _GUICtrlTab_Create($Form1, 24, 48, 417, 350)
$TabSheet1 = _GUICtrlTab_InsertItem($Tab1,  0, "第一个按钮标签1")
$TabSheet2 = _GUICtrlTab_InsertItem($Tab1, 1 , "第一按钮标签2")

$Tab2 = _GUICtrlTab_Create($Form1, 24, 48, 417, 350)
$TabSheet3 = _GUICtrlTab_InsertItem($Tab2,  0, "第二个按钮标签1")
$TabSheet4 = _GUICtrlTab_InsertItem($Tab2,  1, "第二按钮标签2")

GUISetState(@SW_SHOW, $Form1)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit  
                                Case $Button1
                                     ControlHide($Form1, '', $Tab2)
                                         ControlShow($Form1, '', $Tab1)
                                 Case $Button2
                                         ControlHide($Form1, '', $Tab1)
                                         ControlShow($Form1, '', $Tab2)
        EndSwitch
WEnd
 楼主| 发表于 2018-3-16 14:20:40 | 显示全部楼层
回复 13# austere [

你这个效果是达到了,往里面加控件,可四个标签框里都有那个控件,不知是不是AU3写不出来了,还是没有找到方法?
发表于 2018-3-16 15:45:42 | 显示全部楼层
本帖最后由 austere 于 2018-3-16 15:55 编辑

回复 14# qsy666888


    .......     这个UDF里的我也没用过,那就再换回去,用窗口操作~  代码给你~  窗口移动问题自己解决.....
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <GuiTab.au3>



#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 437, -1, -1)

 GUICtrlCreateButton("第一按钮", 512, 64, 75, 25)
$Button2 = GUICtrlCreateButton("第二按钮", 512, 120, 75, 25)

$Tab1 = GUICtrlCreateTab(24, 48, 417, 350)
$TabSheet1 = GUICtrlCreateTabItem( "第一个按钮标签1")
$Label1 = GUICtrlCreateLabel("Label1", 80, 96, 36, 17)
$Input1 = GUICtrlCreateInput("Input1", 48, 128, 121, 21)
$Input2 = GUICtrlCreateInput("Input2", 48, 152, 121, 21)

 GUICtrlCreateTabItem("")
$TabSheet2 = GUICtrlCreateTabItem("第一按钮标签2")
$Combo2 = GUICtrlCreateCombo("Combo2", 56, 200, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Date2 = GUICtrlCreateDate("2018/03/16 06:52:54", 48, 224, 186, 21)
 
 
 $Form2 = GUICreate("Form1", 615, 437, -1, -1)
 $Button1 = GUICtrlCreateButton("第一按钮", 512, 64, 75, 25)
GUICtrlCreateButton("第二按钮", 512, 120, 75, 25)
$Tab2 =  GUICtrlCreateTab(24, 48, 417, 350)
$TabSheet3 = GUICtrlCreateTabItem("第二个按钮标签1")
$Input5 = GUICtrlCreateInput("Input1", 48, 128, 121, 21)
$Input6 = GUICtrlCreateInput("Input2", 48, 152, 121, 21)
$TabSheet4 = GUICtrlCreateTabItem("第二按钮标签2")
$Group2 = GUICtrlCreateGroup("Group2", 224, 80, 185, 41)
GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState(@SW_SHOW, $Form1)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit  
                                Case $Button1
                                        GUISetState(@SW_SHOW, $Form1)
                                        GUISetState(@SW_HIDE, $Form2)
                                 Case $Button2
                    GUISetState(@SW_SHOW, $Form2)
                                        GUISetState(@SW_HIDE, $Form1)
        EndSwitch
WEnd
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-16 18:30 , Processed in 0.082103 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表