使用Splash_UDF后,窗体样式改变的问题。
#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 ;==>_SplashDeletehttp://www.autoitx.com/attachment.php?aid=MjE5Njh8NWMzNmQxZjB8MTM0NTM0NzI3M3xhNTNicE1PU2cxY0crS2x1MVJLeDM0VHZjY0hTaWE1ZFg5TE1kQ2FlV2RFNnRCZw%3D%3D&noupdate=yes
http://www.autoitx.com/attachment.php?aid=MjE5Njl8NThiZDM0NDB8MTM0NTM0NzI3M3xhNTNicE1PU2cxY0crS2x1MVJLeDM0VHZjY0hTaWE1ZFg5TE1kQ2FlV2RFNnRCZw%3D%3D&noupdate=yes
如图1为,当窗体载入后,点击$Button1的系统默认样式
如图2为,当窗体载入后,点击$Button2[预览画面]后,再点击$Button1后弹出的样式。
问:如何更改才使得点击$Button2[预览画面]后,再点击$Button1后的弹出的样式保持如图1所示? 没人碰到过吗???? 回复 2# jscpu
抱歉,这问题我老早就问过了。
没找到高人帮解答,这次希望可以有…… 本帖最后由 xiehuahere 于 2012-8-20 10:52 编辑
其实很简单,就是这个UDF有问题。
_SplashCreate函数第一句:DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)改变了主题风格。
_SplashDelete的时候应该再还原的,作者忽视了这一点。
但是如果使用“Windows经典”主题就没有这个问题。
改一下这个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, $theme
Func _SplashCreate($Pic, $Authorcopy, $Widht = 480, $Height = 272, $Loadmsg = "loading.", $FontColor = 0xFFFFFF, $ProgressBKColor = 0xFFFFFF, $ProgressColor = 0xC0C0C0, $FadeEffectTime = 300,$title='')
$theme = DllCall("uxtheme.dll", "dword", "GetThemeAppProperties")
DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "dword", 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) ;$GUI_EN_ANI_FADEIN
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) ;$GUI_EN_ANI_FADEOUT
GUIDelete($Splash)
DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "dword", $theme)
EndFunc ;==>_SplashDelete
页:
[1]