找回密码
 加入
搜索
查看: 2745|回复: 1

[GUI管理] win7 windows经典主题下不透明!!!!! 求助

[复制链接]
发表于 2013-5-18 23:56:23 | 显示全部楼层 |阅读模式
本帖最后由 53360622 于 2013-5-18 23:57 编辑
;#NoTrayIcon
#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <winapiex.au3>
Opt("GUIOnEventMode", 1)
$hwnd = GUICreate("GDI+Example", 780, 40, -1, 1, $WS_POPUP, $WS_EX_LAYERED, WinGetHandle(AutoItWinGetTitle()))
GUISetBkColor(0xabcdef)
;创建窗口
$label = GUICtrlCreateLabel("", -1, -1, 780, 40, $WS_POPUP)
;创建静态标签(Label)控件
GUICtrlSetBkColor(-1,-2)
GUISetBkColor(0xabcdef)
;为GUI窗口设置背景颜色
_WinAPI_SetLayeredWindowAttributes($hwnd, 0xff010101, 255)
;设置分层窗口属性
GUISetState()
_GDIPlus_Startup()
;初始化微软 Windows GDI+
$graphics = _GDIPlus_GraphicsCreateFromHWND(ControlGetHandle($hwnd, "", $label))
;从窗口句柄创建图形对象
$bitmap = _GDIPlus_BitmapCreateFromGraphics(780, 40, $graphics)
;在一个图形对象上创建基于宽度和高度的位图对象
$backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
;获取图像的图形场景
$ffamily = _GDIPlus_FontFamilyCreate("Arial")
;字休
$arial = _GDIPlus_FontCreate($ffamily, 24, 1)
;字体大小
$sformat = _GDIPlus_StringFormatCreate(0x1000)
;滚动方式0x0001 - 阅读顺序从右到左
_GDIPlus_StringFormatSetAlign($sformat, 1)
;文本居中对齐
$blackbrush = _GDIPlus_BrushCreateSolid(0xFF9900ff)
;字体着色
$pos = 0
$speed = 1
$text = FileRead(@ScriptDir & "\bin.txt")

Do
        _GDIPlus_GraphicsClear($backbuffer, 0xff010101)
        $pos -= $speed
        $rectf = _GDIPlus_RectFCreate($pos, 0, 0, 0)
        $arr = _GDIPlus_GraphicsMeasureString($graphics, $text, $arial, $rectf, $sformat)
        ;测量字符串
        $stringwidth = DllStructGetData($arr[0], "Width")
        ;返回数据结构
        If $pos < -$stringwidth Then $pos = $stringwidth
        _GDIPlus_GraphicsDrawStringEx($backbuffer, $text, $arial, $rectf, $sformat, $blackbrush)
        ;使用数据结构绘制字符串
        _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, 780, 40)
        ;图像绘制到指定的位置
        Sleep(1)
        _ReduceMemory(@AutoItPID)
Until False

Func _ReduceMemory($i_PID = -1)
        If $i_PID <> -1 Then
                Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
                Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
                DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
        Else
                Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
        EndIf

        Return $ai_Return[0]
EndFunc   ;==>_ReduceMemory
发表于 2013-5-19 07:51:57 | 显示全部楼层
分层属性的颜色值和GUI的背景颜色要一致~
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-5 12:04 , Processed in 0.071432 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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