找回密码
 加入
搜索
查看: 596|回复: 6

[特效] 求助,如何让GUI界面在运行时防止闪烁

[复制链接]
发表于 2023-4-21 16:26:40 | 显示全部楼层 |阅读模式
求大佬帮忙看下,如何防止在运行过程中出现闪烁的现象
以下为运行效果图



下方为GUI代码
#RequireAdmin
#include <Process.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

; 设置窗口参数
Local $GuiWidth = 441, $GuiHeight = 251 ; 窗口宽度和高度
Local $GuiTitle = "Form1" ; 窗口标题

; 创建无边框窗口在屏幕居中显示
Local $MainWindow = GUICreate($GuiTitle, $GuiWidth, $GuiHeight, (@DesktopWidth - $GuiWidth) / 2, (@DesktopHeight - $GuiHeight) / 2 , $WS_POPUP,$WS_EX_TOOLWINDOW)

; 设置窗口颜色(蓝色=0x2b579a,绿色=0x217346,红色=0xb7472a)
GUISetBkColor(0x2b579a)

; 创建显示控件
$Label1 = GUICtrlCreateLabel("软件安装", 15, 15, 325, 25)
GUICtrlSetFont(-1, 12, 400, 0, "微软雅黑")
GUICtrlSetColor(-1, 0xFFFFFF)
$Label2 = GUICtrlCreateLabel("请稍候", 124, 82, 165, 75, BitOr(0x200, 0x1))
GUICtrlSetFont(-1, 40, 400, 0, "微软雅黑")
GUICtrlSetColor(-1, 0xFFFFFF)
$Label3 = GUICtrlCreateLabel('....', 290, 82, 55, 75)
GUICtrlSetFont(-1, 40, 400, 0, "微软雅黑")
GUICtrlSetColor(-1, 0xFFFFFF)
$Label4 = GUICtrlCreateLabel("正在安装:", 15, 205, 410, 25)
GUICtrlSetFont(-1, 12, 400, 0, "微软雅黑")
GUICtrlSetColor(-1, 0xFFFFFF)
$Label5 = GUICtrlCreateLabel("(00/00)", 348, 15, 80, 25, BitOr(0x200, 0x1))
GUICtrlSetFont(-1, 12, 400, 0, "微软雅黑")
GUICtrlSetColor(-1, 0xFFFFFF)
GUISetState(@SW_SHOW)

; 循环显示动态效果
AdlibRegister("MyAdLibFunc", 500)

; 动态显示
Func MyAdLibFunc()
    ; 分配一个静态变量保存函数调用的次数.
    Local Static $iCount = 0
    $iCount += 1
    If $iCount = 1 Then GUICtrlSetData($Label3, '.')
    If $iCount = 2 Then GUICtrlSetData($Label3, '..')
    If $iCount = 3 Then GUICtrlSetData($Label3, '...')
    If $iCount = 4 Then
        GUICtrlSetData($Label3, '....')
        $iCount = 0
    EndIf
EndFunc

; 进入消息循环,等待用户交互
While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

; 删除窗口,并结束程序
GUIDelete($MainWindow)

本帖子中包含更多资源

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

×
发表于 2023-4-21 17:24:38 | 显示全部楼层
我的笨方法仅供参考,不建议采用!https://www.autoitx.com/thread-73241-1-1.html 代码:1楼代码 60 至 69 行
等高手解答,我也学习一下!
 楼主| 发表于 2023-4-21 17:35:40 | 显示全部楼层
chishingchan 发表于 2023-4-21 17:24
我的笨方法仅供参考,不建议采用!https://www.autoitx.com/thread-73241-1-1.html 代码:1楼代码 60 至 69 ...




权限不够

本帖子中包含更多资源

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

×
发表于 2023-4-21 22:02:20 | 显示全部楼层
本帖最后由 chishingchan 于 2023-4-21 22:04 编辑

简单的可以解释为:
While 1
$y = 获取控件状态
If $x <> $y Then ;当控件变化时
  ;执行某些语句
EndIf
$x = $y ;让控件状态赋值于变量(相等)
;其他语句
WEnd
发表于 2023-4-24 10:31:53 | 显示全部楼层
路过,看看,学习学习。
发表于 2023-4-24 18:57:02 | 显示全部楼层
加个Sleep(250)试下
发表于 2023-8-8 10:46:29 | 显示全部楼层
楼主的审美不错
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-29 20:11 , Processed in 0.077263 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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