找回密码
 加入
搜索
楼主: nmgwddj

[GUI管理] 滚动文字提问!(已解决)

 火.. [复制链接]
 楼主| 发表于 2010-5-14 16:34:31 | 显示全部楼层
本帖最后由 nmgwddj 于 2010-5-15 04:18 编辑

太完美了 吧代码奉上
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#NoTrayIcon
$Form1 = GUICreate("滚动文字", 600, 40, 192, 654, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED))
GUISetBkColor(0xABCDEF)
$txt = IniRead('Time.ini', '设置', '滚动文字', 0)
$Label1 = GUICtrlCreateLabel($txt, 0, 0, StringLen($txt) * 40, 40)
GUICtrlSetColor($Label1, 0xe000ff)
GUICtrlSetFont($Label1, 30, 400, 0, '黑体')
GUISetState(@SW_SHOW)
_API_SetLayeredWindowAttributes($Form1, 0xABCDEF)
move()
Func move()
        $T = 0
        While 1
                $s = StringLen($txt) + 600
                Do
                        ControlMove('滚动文字', '', $Label1, $s - 1, 0)
                        $s -= 1
                        Sleep(IniRead('Time.ini', '设置', '滚动速度', 10))
                Until $s = -StringLen($txt) * 40
                $T += 1
                If $T = IniRead('Time.ini', '设置', '滚动次数', 0) Then Exit
        WEnd
EndFunc   ;==>move

Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)

        Local Const $AC_SRC_ALPHA = 1
        Local Const $ULW_ALPHA = 2
        Local Const $LWA_ALPHA = 0x2
        Local Const $LWA_COLORKEY = 0x1
        If Not $isColorRef Then
                $i_transcolor = Hex(String($i_transcolor), 6)
                $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
        EndIf
        Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
        Select
                Case @error
                        Return SetError(@error, 0, 0)
                Case $Ret[0] = 0
                        Return SetError(4, 0, 0)
                Case Else
                        Return 1
        EndSelect
EndFunc   ;==>_API_SetLayeredWindowAttributes
发表于 2010-5-14 19:16:48 | 显示全部楼层
AU3真的很强大哦.
发表于 2010-5-14 22:14:17 | 显示全部楼层
cpu 100% 这种效果中看不中用.
发表于 2010-5-14 22:25:41 | 显示全部楼层
把第 30 行改为 Sleep(IniRead('Time.ini', '设置', '滚动速度', 10)) 改变默认无ini的sleep的时间。(降低cpu占用)
且15-21行多余。
闪烁无法解决就很纠结~没搞头~~
发表于 2010-5-15 00:42:00 | 显示全部楼层
闪烁的确是个问题,没想出什么好办法解决。
 楼主| 发表于 2010-5-15 04:05:46 | 显示全部楼层
windows7 下没有闪烁效果 所以一直没有发现。今天换网吧XP系统了 有发现了。。
发表于 2010-5-15 15:50:34 | 显示全部楼层
闪烁的问题只能换别的语言双缓冲实现啦呵呵
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-11 11:45 , Processed in 0.070710 second(s), 13 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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