找回密码
 加入
搜索
查看: 2339|回复: 0

[GUI管理] 使用Splash_UDF后,窗体样式改变的问题。

[复制链接]
发表于 2012-6-27 23:54:27 | 显示全部楼层 |阅读模式
#include <Splash_UDF.au3> 
Global $Picture = @ScriptDir & "\bg.jpg", $TextColor = 0xFFFFFF, $ProgressBarBGColor = 0xFFFFFF, $ProgressBarColor = 0xff0000
$Form1 = GUICreate("启动画面", 335, 222)
$Button1 = GUICtrlCreateButton("测试样式", 100, 180, 75, 20)
$Button2 = GUICtrlCreateButton("预览画面", 200, 180, 75, 20)
GUISetState(@SW_SHOW)
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        MsgBox(0,0,'This is a test!')
                Case $Button2
                        _load()
        EndSwitch
WEnd
Func _load()
        GUISetState(@SW_HIDE,$Form1)
                $font = "微软雅黑"
            $title="半芯竹"
                        $inputloadmsg = '正在启动 '
                        $loadmsg1 = '正在调用窗体组件...'
                        $loadmsg2 = '正在调用支持组件...'
                        $loadmsg3 = '正在调用运行库等组件...'
                        $authormsg = 'www.autoitx.com'
                        $inputWidth = '480'
                        $inputheigh = '272'
                        $title = '半芯竹'
                        _SplashCreate($Picture, $authormsg, $inputWidth, $inputheigh, $inputloadmsg, $TextColor, $ProgressBarBGColor, $ProgressBarColor,$title)
                        Sleep(500)
                        _SplashUpdate($loadmsg1)
                        For $i = 0 To 100 Step 20
                                Sleep(200)
                                _SplashProgressUpdate($i)
                        Next
                        Sleep(500)
                        _SplashUpdate($loadmsg2)
                        _SplashProgressUpdate(60)
                        Sleep(500)
                        _SplashProgressUpdate(100)
                        Sleep(500)
                        _SplashUpdate($loadmsg3)
                        _SplashProgressUpdate(60)
                        Sleep(500)
                        _SplashProgressUpdate(70)
                        Sleep(500)
                        _SplashProgressUpdate(100)
                        Sleep(1000)
                        _Splashdelete()
                        GUISetState(@SW_SHOW,$Form1)
EndFunc

以上为程序,以下为所需的Splash_UDF
#include-once
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
; #INDEX# =======================================================================================================================
; Title .........: Splash_UDF
; AutoIt Version : 3.3.6.1
; Description ...: Functions to easily create a boot splash
; Author(s) .....: Dragonlair
; ===============================================================================================================================
Global $Splash, $SplashUpdate, $FadeEffectTime, $Progress

Func _SplashCreate($Pic, $Authorcopy, $Widht = 480, $Height = 272, $Loadmsg = "loading.", $FontColor = 0xFFFFFF, $ProgressBKColor = 0xFFFFFF, $ProgressColor = 0xC0C0C0, $FadeEffectTime = 300,$title='')
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
        $Splash = GUICreate("", $Widht, $Height, -1, -1, BitOR($WS_SYSMENU, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE, $WS_EX_TOOLWINDOW))
        GUICtrlCreatePic($Pic, 0, 0, $Widht, $Height)
        GUICtrlCreateLabel($Loadmsg&$title, 15, ($Height - 80), 438, 17)
        GUICtrlSetColor(-1, $FontColor)
        GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
        $SplashUpdate = GUICtrlCreateLabel("", 15, ($Height - 49), 438, 17)
        GUICtrlSetColor(-1, $FontColor)
        GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
        $Progress = GUICtrlCreateProgress(15, ($Height - 33), 198, 7, $PBS_SMOOTH)
        GUICtrlSetColor(-1, $ProgressColor)
        GUICtrlSetBkColor(-1, $ProgressBKColor)
        GUICtrlCreateLabel("Copyright   2010 - " & @YEAR & " " & $Authorcopy, 16, ($Height - 20), 438, 14)
        GUICtrlSetFont(-1, 8, 800, 0, "Arial")
        GUICtrlSetColor(-1, $FontColor)
        GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Splash, "int", $FadeEffectTime, "long", 0x00080000)
        GUISetState()
EndFunc   ;==>_SplashCreate

Func _SplashUpdate($updatemsg)
        GUICtrlSetData($SplashUpdate, $updatemsg)
EndFunc   ;==>_SplashUpdate

Func _SplashProgressUpdate($ProgValue)
        if $ProgValue < GUICtrlRead($Progress) Then GUICtrlSetData($Progress, 0)
        For $i = GUICtrlRead($Progress) To $ProgValue Step 1
                Sleep(10)
                GUICtrlSetData($Progress, $i)
        Next
EndFunc   ;==>_SplashProgressUpdate

Func _SplashDelete()
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Splash, "int", $FadeEffectTime, "long", 0x00090000)
        GUIDelete($Splash)
EndFunc   ;==>_SplashDelete





如图1为,当窗体载入后,点击$Button1的系统默认样式
如图2为,当窗体载入后,点击$Button2[预览画面]后,再点击$Button1后弹出的样式。
问:如何更改才使得点击$Button2[预览画面]后,再点击$Button1后的弹出的样式保持如图1所示?

本帖子中包含更多资源

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

×
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-18 22:52 , Processed in 0.080103 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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