找回密码
 加入
搜索
查看: 4693|回复: 12

关于透明窗口图片的问题

  [复制链接]
发表于 2009-7-5 13:21:35 | 显示全部楼层 |阅读模式
本帖最后由 傻娃 于 2009-7-5 15:24 编辑

弄了个透明窗口,但是加上图片控件的时候窗口却不透明了,
下面是代码,各位帮忙看下...

能不能设置成透明的

;如果把图片那个控件删除了就能透明了    我是想有图片控件也让他透明..




#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>

#NoTrayIcon
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 180, 269, 968, 1,$WS_POPUP, $WS_EX_LAYERED,WinGetHandle("Program Manager"))
GUISetBkColor(0x010101)
_API_SetLayeredWindowAttributes($Form1, 0x010101)
$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\Administrator\桌面\logo.jpg", 8, 8, 164, 100,BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Label1 = GUICtrlCreateLabel("██████████", 8, 120, 164, 17)
GUICtrlSetFont(-1, 9, 400, 4)
GUICtrlSetColor(-1, 0x0000ff)
GUICtrlSetCursor(-1, 0)
$Label2 = GUICtrlCreateLabel("██████████", 8, 144, 164, 17)
GUICtrlSetFont(-1, 9, 400, 4)
GUICtrlSetColor(-1, 0x0000ff)
GUICtrlSetCursor(-1, 0)
$Label3 = GUICtrlCreateLabel("██████████", 8, 168, 164, 17)
GUICtrlSetFont(-1, 9, 400, 4)
GUICtrlSetColor(-1, 0x0000ff)
GUICtrlSetCursor(-1, 0)
$Label4 = GUICtrlCreateLabel("██████████", 8, 192, 164, 17)
GUICtrlSetFont(-1, 9, 400, 4)
GUICtrlSetColor(-1, 0x0000ff)
GUICtrlSetCursor(-1, 0)
$Label5 = GUICtrlCreateLabel("██████████", 8, 216, 164, 17)
GUICtrlSetFont(-1, 9, 400, 4)
GUICtrlSetColor(-1, 0x0000ff)
GUICtrlSetCursor(-1, 0)
$Label6 = GUICtrlCreateLabel("██████████", 8, 240, 164, 17)
GUICtrlSetFont(-1, 9, 400, 4)
GUICtrlSetColor(-1, 0x0000ff)
GUICtrlSetCursor(-1, 0)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd

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

本帖子中包含更多资源

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

×
发表于 2009-7-5 15:15:21 | 显示全部楼层
其他不要改动将_API_SetLayeredWindowAttributes($Form1, 0x010101)剪切放到这里就行了
_API_SetLayeredWindowAttributes($Form1, 0x010101) 
GUISetState(@SW_SHOW)

本帖子中包含更多资源

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

×
 楼主| 发表于 2009-7-5 15:24:38 | 显示全部楼层
十分感谢
发表于 2009-7-5 16:28:27 | 显示全部楼层
哈,又学了一招
发表于 2009-10-10 12:12:56 | 显示全部楼层
留个名 这个真不错
发表于 2009-11-17 22:16:51 | 显示全部楼层
又学到一点了
发表于 2009-11-26 22:23:47 | 显示全部楼层
高手就是高
发表于 2009-11-29 16:06:17 | 显示全部楼层
又学习一招,谢谢了
发表于 2009-12-2 00:14:47 | 显示全部楼层
收藏!!
发表于 2010-4-3 19:34:25 | 显示全部楼层
学到了。 谢谢
发表于 2011-6-20 05:13:48 | 显示全部楼层
好东西,学到了
发表于 2012-10-19 13:43:21 | 显示全部楼层
非常不错。。。。。
发表于 2014-3-4 11:43:42 | 显示全部楼层
$WS_CLIPSIBLINGS为啥我找不到这个的定义?
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-28 13:23 , Processed in 0.097507 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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