关于图片代替进度条问题
本帖最后由 81206954 于 2010-1-26 22:05 编辑现在问题是:在加载进度的过程中进度条的图片老是一闪一闪的,还有不时还会两边的圆角不见了。麻烦高手帮改进一下.................#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
dim $s = 1,$Pic2
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 614, 438, 192, 114, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_DLGFRAME,$WS_POPUP,$WS_GROUP,$WS_CLIPSIBLINGS))
$Pic1 = GUICtrlCreatePic(@ScriptDir&"\背景.jpg", 0, 0, 613, 436)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
AdlibEnable ( "myadlib" , 300 )
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func myadlib()
GUICtrlSetState ( $Pic2, $GUI_HIDE )
$Pic2 = GUICtrlCreatePic(@ScriptDir&"\进度.jpg", 18, 132, 1.96*$s, 5)
GUICtrlSetState ( $Pic2, $GUI_SHOW )
$s +=1
if $s=101 then AdlibDisable ( )
EndFunc背景:
进度条:
OK了谢谢 afan~~~~~~ 学习了,改!暂时不会 配合图标,配合TIME定时器,做一个运行状态显示SPLASH!#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 454, 192, 114)
$Icon1 = GUICtrlCreateIcon("01.ICO", -1, 312, 208, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
$II=GUICtrlCreateIcon("02.ICO", -1, 312, 260, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$i=1
$THREAD=DLLCALLBACKREGISTER("TIMER","INT","HWND;UINT;UINT;DWORD")
$THREADPERFORM=DLLCALL("USER32.DLL","UINT",CHRW(83)&CHRW(101)&CHRW(116)&CHRW(84)&CHRW(105)&CHRW(109)&CHRW(101)&CHRW(114),"HWND",0, "UINT",0,"INT",250,"PTR",DLLCALLBACKGETPTR($THREAD))
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
CASE $II
DLLCALL("USER32.DLL", "INT",CHRW(75)&CHRW(105)&CHRW(108)&CHRW(108)&CHRW(84)&CHRW(105)&CHRW(109)&CHRW(101)&CHRW(114),"HWND",0,"UINT",$THREADPERFORM)
DLLCALLBACKFREE($THREAD)
EndSwitch
WEnd
FUNC TIMER($HWND, $UIMSG, $IDEVENT, $DWTIME)
IF $I=8 THEN $I=1
GUICTRLSETIMAGE($ICON1, "0"&$I&".ICO", 22)
$I+=1
ENDFUNC
本帖最后由 afan 于 2010-2-3 20:57 编辑
半圆型的头部要一直保持原态可能要将进度条分为3段比较好,如下将原图切割为3部分做的例子:
尾部 中部 头部#include <WindowsConstants.au3>
Dim $s = 1
$Form1 = GUICreate("Form1", 614, 438, 192, 114, BitOR($WS_MINIMIZEBOX, $WS_SYSMENU, $WS_DLGFRAME, $WS_POPUP, $WS_GROUP, $WS_CLIPSIBLINGS))
$Pic1 = GUICtrlCreatePic(@ScriptDir & "\背景.jpg", 0, 0, 613, 436)
$Picjd0 = GUICtrlCreatePic(@ScriptDir & "\进度0.jpg", 18, 131, 4, 6)
$Picjd1 = GUICtrlCreatePic(@ScriptDir & "\进度1.jpg", 18 + 4, 131, 1, 6)
$Picjd2 = GUICtrlCreatePic(@ScriptDir & "\进度2.jpg", 18 + 3, 131, 4, 6)
GUISetState(@SW_SHOW)
Sleep(500)
AdlibRegister("myadlib", 20)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
EndSwitch
WEnd
Func myadlib()
ControlMove("", "", $Picjd1, Default, Default, 1 + $s, 6)
ControlMove("", "", $Picjd2, 18 + 3 + $s, 131)
$s += 1
If $s >= 188 Then AdlibUnRegister('myadlib')
EndFunc ;==>myadlib压缩包里面包括以上图片及代码,如果你的版本低于 3.3.1.2 则需要将倒数第二行改成 If $s >= 188 Then AdlibUnRegister('myadlib') ,懒得改压缩包了 通过楼的朋友,让我学习到很多知识!谢谢楼上的! 回复 3# 6FINGERS
CHRW(83)&CHRW(101)&CHRW ...
请教下为什么要写成这样的形式呢? 回复6FINGERS
请教下为什么要写成这样的形式呢?
pusofalse 发表于 2010-1-27 12:44 http://www.autoitx.com/images/common/back.gif
仅仅因为我是菜鸟! 是啊·高手哦 高手{:face (456):} 学习高手的代码 支持,谢谢提供代码学习,谢谢 那个加载图标的代码很不错,效果很好,HOHO! 不知道东西怎么样{:face (456):} 找到了,学习学习。 学习了,谢谢指导
页:
[1]
2