界面切换的问题
请问 现在我写好了一个软件窗口的主界面但同时主界面上有按钮连接到其他几个子界面
PS:子界面与主界面基本一样,只是按钮文本不一样,另外按钮连接也不一样
我该怎么写连接界面?
几个界面之间怎么来回切换?
本人小菜一个如果说的不清楚
望见谅谢谢大家
[ 本帖最后由 landays 于 2008-9-23 17:06 编辑 ] 源码贴上来 表述是有很大的不清楚 #Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=D:autoit3Aut2ExeIconsdocuments-white-exec.ico
#AutoIt3Wrapper_outfile=系统设置.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseAnsi=y
#AutoIt3Wrapper_Res_Description=设置优化工具
#AutoIt3Wrapper_Res_Fileversion=0.0.0.2
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=P
#AutoIt3Wrapper_Res_LegalCopyright=days
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#Region AutoIt3Wrapper 预编译参数(常用参数)
;#AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer% ;自定义资源段
;#AutoIt3Wrapper_Run_Tidy= ;脚本整理
;#AutoIt3Wrapper_Run_AU3Check= ;语法检查
;#AutoIt3Wrapper_Run_Before= ;运行前
;#AutoIt3Wrapper_Run_After= ;运行后
#EndRegion AutoIt3Wrapper 预编译参数(常用参数)
#cs ____________________________________
#ce _______________脚本开始_________________
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GuiStatusBar.au3>
#NoTrayIcon
$Form1 = GUICreate("系统设置" , 637, 425)
$ButtonExit = GUICtrlCreateButton("退 出", 550, 360, 50, 25, 0)
$Group2 = GUICtrlCreateGroup("菜单切换", 8, 3, 193, 105)
$Button50 = GUICtrlCreateButton ( "系统设置", 15, 25, 85, 30, 0,$WS_EX_TRANSPARENT + $WS_EX_CLIENTEDGE)
$Button51 = GUICtrlCreateButton ( "优化工具", 110, 25, 85, 30, 0,$WS_EX_TRANSPARENT + $WS_EX_CLIENTEDGE)
$Button52 = GUICtrlCreateButton ( "批处理", 15, 68, 85, 30, 0,$WS_EX_TRANSPARENT + $WS_EX_CLIENTEDGE)
$Button53 = GUICtrlCreateButton ( "注册表",110, 68, 85, 30, 0,$WS_EX_TRANSPARENT + $WS_EX_CLIENTEDGE)
$ty = ("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionWinlogon")
$typsd = ("DefaultPassword")
$psd = RegRead($ty, $typsd)
$SCR = "1"
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE Or $nMsg = $ButtonExit
Exit
EndSelect
WEnd 意思就是我搞了一个主窗口
有4个按钮连接到不同界面
但每个界面的内容都不一样
该怎么互相连接
我真的很菜吧。。 父子窗口问题。请学会搜索。
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=D:autoit3Aut2ExeIconsdocuments-white-exec.ico
#AutoIt3Wrapper_outfile=系统设置.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseAnsi=y
#AutoIt3Wrapper_Res_Description=设置优化工具
#AutoIt3Wrapper_Res_Fileversion=0.0.0.2
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GuiStatusBar.au3>
#NoTrayIcon
$Form1 = GUICreate("主介面" , 637, 425)
$ButtonExit = GUICtrlCreateButton("退 出", 550, 360, 50, 25, 0)
$Group2 = GUICtrlCreateGroup("菜单切换", 8, 3, 193, 105)
$Button50 = GUICtrlCreateButton ( "系统设置", 15, 25, 85, 30, 0,$WS_EX_TRANSPARENT + $WS_EX_CLIENTEDGE)
$Button51 = GUICtrlCreateButton ( "优化工具", 110, 25, 85, 30, 0,$WS_EX_TRANSPARENT + $WS_EX_CLIENTEDGE)
$Button52 = GUICtrlCreateButton ( "批处理", 15, 68, 85, 30, 0,$WS_EX_TRANSPARENT + $WS_EX_CLIENTEDGE)
$Button53 = GUICtrlCreateButton ( "注册表",110, 68, 85, 30, 0,$WS_EX_TRANSPARENT + $WS_EX_CLIENTEDGE)
GUISetState(@SW_SHOW)
$Form1_1 = GUICreate("系统设置" , 637, 425, -1, -1, -1, -1)
$ButtonExit11 = GUICtrlCreateButton("返 回", 550, 360, 50, 25, 0)
$ty = ("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionWinlogon")
$typsd = ("DefaultPassword")
$psd = RegRead($ty, $typsd)
$SCR = "1"
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $ButtonExit
Exit
Case $Button50
GUISetState(@SW_HIDE, $Form1)
GUISetState(@SW_SHOW, $Form1_1)
Case $Button51
Case $Button52
Case $Button53
Case $ButtonExit11
GUISetState(@SW_HIDE, $Form1_1)
GUISetState(@SW_SHOW, $Form1)
EndSwitch
WEnd
不错,学习了/谢谢楼上 GUIOnevent模式就是一个很好的例子!
#include <GUIConstants.au3>
Opt("GUIOneventMode",1)
Dim $Button
$WinMain= GUICreate("主窗口", 450, 300) ;创建主窗口
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") ;注册窗口关闭事件到函数_Exit
$Button= GUICtrlCreateButton("显示子窗口 1", 0, 0, 113, 49)
$Button= GUICtrlCreateButton("显示子窗口 2", 216, 0, 105, 49)
$WinSub1= GUICreate("子窗口", 220, 60) ;创建子窗口1
GUISetOnEvent($GUI_EVENT_CLOSE, "GUICtrlMsg") ;注册窗口关闭事件到函数GUICtrlMsg
$Button = GUICtrlCreateButton("确认", 0, 0, 100, 50)
$Button = GUICtrlCreateButton("取消", 110, 0, 100, 50);创建子窗口中按钮二
$WinSub2= GUICreate("子窗口", 220, 60) ;创建子窗口2
GUISetOnEvent($GUI_EVENT_CLOSE, "GUICtrlMsg") ;注册窗口关闭事件到函数GUICtrlMsg
$Button = GUICtrlCreateButton("确认", 0, 0, 100, 50)
$Button = GUICtrlCreateButton("取消", 110, 0, 100, 50);创建子窗口中按钮二
For $I = 5 To 0 Step -1
GUICtrlSetOnEvent($Button[$I],"GUICtrlMsg") ;注册总共的六个按钮点击事件到函数 GUICtrlMsg
;请区分 GUISetOnEvent 和 GUICtrlSetOnEvent的区别
Next
GUISwitch($WinMain) ;切换当前窗口到主窗口
GUISetState(@SW_SHOW) ;显示当前窗口
While 1
Sleep(1000)
WEnd
Func GUICtrlMsg()
Switch @GUI_CtrlId;选择事件 ID 或 控件 ID
Case $GUI_EVENT_CLOSE;如果点下的是$GUI_EVENT_CLOSE(关闭)
GUISetState(@SW_HIDE,@GUI_WinHandle);隐藏产生事件的窗口
Case $Button
GUISetState(@SW_SHOW,$WinSub1);显示 子窗口 1
Case $Button
GUISetState(@SW_SHOW,$WinSub2);显示 子窗口 2
Case $Button
MsgBox(48,0,"你点了子窗口 1 中的第一个按钮")
Case $Button
GUISetState(@SW_HIDE,$WinSub1);隐藏 子窗口 1
Case $Button
MsgBox(48,0,"你点了主窗口 2 中的第一个按钮")
Case $Button
GUISetState(@SW_HIDE,$WinSub2);隐藏 子窗口 2
EndSwitch
EndFunc
Func _Exit()
Exit
EndFunc
正学习中呢
页:
[1]