找回密码
 加入
搜索
查看: 3484|回复: 3

[系统综合] 求教,如何实现打开程序时默认按下$Button1 按钮。

[复制链接]
发表于 2015-5-9 00:03:06 | 显示全部楼层 |阅读模式
本帖最后由 木头人 于 2015-5-12 19:27 编辑
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include '_dButton.au3'
Dim $XPic1 , $SS_NOTIFY
$XForm1 = GUICreate("控制台", 800, 500,-1,-1)
$XPic1 = GUICtrlCreatePic(@ScriptDir & "\didi.jpg", 0, 0, 800, 68, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)
$Button1 = GUICtrlCreateButton("", 30, 40, 88, 24, $BS_BITMAP)
GUICtrlSetImage(-1, "rb1.bmp")
GUICtrlSetCursor(-1, 0)
$Button2 = GUICtrlCreateButton("", 130, 40, 88, 24, $BS_BITMAP)
GUICtrlSetImage(-1, "op1.bmp")
GUICtrlSetCursor(-1, 0)
$Button3 = GUICtrlCreateButton("", 230, 40, 88, 24, $BS_BITMAP)
GUICtrlSetImage(-1, "br1.bmp")
GUICtrlSetCursor(-1, 0)
$Button4 = GUICtrlCreateButton("", 330, 40, 88, 24, $BS_BITMAP)
GUICtrlSetImage(-1, "zz1.bmp")
GUICtrlSetCursor(-1, 0)


$Form2 = GUICreate("Tabbed Notebook Dialog", 420, 320, 30, 30, $WS_CHILD,"", $XForm1)
$dLabel1 = GUICtrlCreateLabel("窗口1", 152, 124, 72, 17, $WS_GROUP)


$Form3 = GUICreate("Tabbed Notebook Dialog", 420, 320, 30, 30, $WS_CHILD,"", $XForm1)
$dLabel2 = GUICtrlCreateLabel("窗口2", 152, 154, 72, 17, $WS_GROUP)


$Form4 = GUICreate("About", 340, 253, 30, 30, $WS_CHILD,"", $XForm1)
$dLabel1 = GUICtrlCreateLabel("窗口3", 152, 194, 72, 17, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Form5 = GUICreate("About", 340, 253, 30, 30, $WS_CHILD,"", $XForm1)
$dLabel1 = GUICtrlCreateLabel("窗口4", 152, 224, 72, 17, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)

Local $Current = ""
        _dButton($XForm1, $Button1, "rb1.bmp", "rb2.bmp", "srb2.bmp")
        _dButton($XForm1, $Button2, "op1.bmp", "op2.bmp", "op2.bmp")
        _dButton($XForm1, $Button3, "br1.bmp", "br2.bmp", "br2.bmp")
        _dButton($XForm1, $Button4, "zz1.bmp", "zz2.bmp", "zz2.bmp")
GUISetState(@SW_SHOW, $XForm1)


While 1

        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        If $Current <> "" Then GUISetState(@SW_HIDE, $Current)
                        GUISetState(@SW_SHOW, $Form2)
                        $Current = $Form2
                Case $Button2
                        If $Current <> "" Then GUISetState(@SW_HIDE, $Current)
                        GUISetState(@SW_SHOW, $Form3)
                        $Current = $Form3                        
                Case $Button3
                        If $Current <> "" Then GUISetState(@SW_HIDE, $Current)
                        GUISetState(@SW_SHOW, $Form4)
                        $Current = $Form4   
                Case $Button4
                        If $Current <> "" Then GUISetState(@SW_HIDE, $Current)
                        GUISetState(@SW_SHOW, $Form5)
                        $Current = $Form5                                                   
        EndSwitch
WEnd
求教,如何实现打开程序时默认按下$Button1 按钮。
想要实现在程序打开时,显示$Button1 按钮的内容,谢谢。
发表于 2015-5-9 01:52:36 | 显示全部楼层
很想告诉你,不过实在没看明白你的要求
 楼主| 发表于 2015-5-12 19:28:00 | 显示全部楼层
求助,谢谢了。
发表于 2015-5-16 09:06:22 | 显示全部楼层
我能明白你的意思,但这个问题实在是……小学生都会。
你把$button1中的代码在while循环前运行一次就ok了? 这么简单的问题。哎……

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include '_dButton.au3'
Dim $XPic1, $SS_NOTIFY
$XForm1 = GUICreate("控制台", 800, 500, -1, -1)
$XPic1 = GUICtrlCreatePic(@ScriptDir & "\didi.jpg", 0, 0, 800, 68, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)
$Button1 = GUICtrlCreateButton("", 30, 40, 88, 24, $BS_BITMAP)
GUICtrlSetImage(-1, "rb1.bmp")
GUICtrlSetCursor(-1, 0)
$Button2 = GUICtrlCreateButton("", 130, 40, 88, 24, $BS_BITMAP)
GUICtrlSetImage(-1, "op1.bmp")
GUICtrlSetCursor(-1, 0)
$Button3 = GUICtrlCreateButton("", 230, 40, 88, 24, $BS_BITMAP)
GUICtrlSetImage(-1, "br1.bmp")
GUICtrlSetCursor(-1, 0)
$Button4 = GUICtrlCreateButton("", 330, 40, 88, 24, $BS_BITMAP)
GUICtrlSetImage(-1, "zz1.bmp")
GUICtrlSetCursor(-1, 0)


$Form2 = GUICreate("Tabbed Notebook Dialog", 420, 320, 30, 30, $WS_CHILD, "", $XForm1)
$dLabel1 = GUICtrlCreateLabel("窗口1", 152, 124, 72, 17, $WS_GROUP)


$Form3 = GUICreate("Tabbed Notebook Dialog", 420, 320, 30, 30, $WS_CHILD, "", $XForm1)
$dLabel2 = GUICtrlCreateLabel("窗口2", 152, 154, 72, 17, $WS_GROUP)


$Form4 = GUICreate("About", 340, 253, 30, 30, $WS_CHILD, "", $XForm1)
$dLabel1 = GUICtrlCreateLabel("窗口3", 152, 194, 72, 17, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Form5 = GUICreate("About", 340, 253, 30, 30, $WS_CHILD, "", $XForm1)
$dLabel1 = GUICtrlCreateLabel("窗口4", 152, 224, 72, 17, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)

Local $Current = ""
_dButton($XForm1, $Button1, "rb1.bmp", "rb2.bmp", "srb2.bmp")
_dButton($XForm1, $Button2, "op1.bmp", "op2.bmp", "op2.bmp")
_dButton($XForm1, $Button3, "br1.bmp", "br2.bmp", "br2.bmp")
_dButton($XForm1, $Button4, "zz1.bmp", "zz2.bmp", "zz2.bmp")
GUISetState(@SW_SHOW, $XForm1)
If $Current <> "" Then GUISetState(@SW_HIDE, $Current)
GUISetState(@SW_SHOW, $Form2)
$Current = $Form2

While 1

        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        If $Current <> "" Then GUISetState(@SW_HIDE, $Current)
                        GUISetState(@SW_SHOW, $Form2)
                        $Current = $Form2
                Case $Button2
                        If $Current <> "" Then GUISetState(@SW_HIDE, $Current)
                        GUISetState(@SW_SHOW, $Form3)
                        $Current = $Form3
                Case $Button3
                        If $Current <> "" Then GUISetState(@SW_HIDE, $Current)
                        GUISetState(@SW_SHOW, $Form4)
                        $Current = $Form4
                Case $Button4
                        If $Current <> "" Then GUISetState(@SW_HIDE, $Current)
                        GUISetState(@SW_SHOW, $Form5)
                        $Current = $Form5
        EndSwitch
WEnd
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-12-22 22:02 , Processed in 0.222720 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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