找回密码
 加入
搜索
查看: 4476|回复: 7

[GUI管理] 关于叠加 label 显示的问题

  [复制链接]
发表于 2011-4-26 08:40:33 | 显示全部楼层 |阅读模式
我创建了两个 label 大一点的是 label1  小点的是 label 2  我把 2叠加在 1上面 想在 2上输出文字 但是 就是不显示啊 我把 两个label 都设置了 $SS_ETCHEDFRAME 样式  如果把 小的label 的 该属性去掉 就可以显示了 请高手指点 如何不去掉小的label 的 $SS_ETCHEDFRAME  属性 能正常显示




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

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Administrator\桌面\Form1.kxf
$Form1 = GUICreate("Form1", 205, 130, 598, 400, $WS_POPUP, $WS_EX_LAYERED)
    GUISetBkColor(0xABCDEF)
    _API_SetLayeredWindowAttributes($Form1, 0x010101)
$Label1 = GUICtrlCreateLabel("", 8, 96, 188, 25 ,$SS_ETCHEDHORZ And $SS_GRAYRECT, $GUI_WS_EX_PARENTDRAG)
$Label2 = GUICtrlCreateLabel("", 0, 0, 204, 129, $SS_ETCHEDFRAME)
FileInstall("封装logo图片.bmp",@TempDir& "\封装logo图片.bmp",1)
$Pic1 = GUICtrlCreatePic(@TempDir& "\封装logo图片.bmp", 8, 8, 185, 81)
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###
Dim  $val
 $val= IniRead(@ScriptDir&"\num.ini","num","val","notfound")
  If $val=100 Then
          MsgBox(0,"","已经5次")
          Exit
  Else
         GUICtrlSetData($Label1, "已经运行的次数:"&$val)
        
         $val=$val+1
          IniWrite(@ScriptDir&"\num.ini","num","val",$val)
  EndIf
  
 FileDelete(@TempDir&"\封装logo图片.bmp")

  HotKeySet("{Esc}","quit")
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
        Case $Form1 =$GUI_CHECKED 
                        _API_SetLayeredWindowAttributes($Form1, 0xABCDEF)
                        
        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
发表于 2011-4-26 10:21:22 | 显示全部楼层
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Administrator\桌面\Form1.kxf
$Form1 = GUICreate("Form1", 205, 130, 598, 400, BitOR($WS_POPUP,$WS_DLGFRAME), $WS_EX_LAYERED)
    GUISetBkColor(0xABCDEF)
    _API_SetLayeredWindowAttributes($Form1, 0x010101)
$Label1 = GUICtrlCreateLabel("", 8, 96, 188, 25 ,$SS_ETCHEDHORZ And $SS_GRAYRECT, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetBkColor(-1,-2)
$Label2 = GUICtrlCreateLabel("afdsafsdfdafdsafd", 0, 0, 204, 129)
GUICtrlSetBkColor(-1,-2)
FileInstall("封装logo图片.bmp",@TempDir& "\封装logo图片.bmp",1)
$Pic1 = GUICtrlCreatePic(@TempDir& "\封装logo图片.bmp", 8, 8, 185, 81)
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###
Dim  $val
 $val= IniRead(@ScriptDir&"\num.ini","num","val","notfound")
  If $val=100 Then
          MsgBox(0,"","已经5次")
          Exit
  Else
         GUICtrlSetData($Label1, "已经运行的次数:"&$val)
        
         $val=$val+1
          IniWrite(@ScriptDir&"\num.ini","num","val",$val)
  EndIf
  
 FileDelete(@TempDir&"\封装logo图片.bmp")

  HotKeySet("{Esc}","quit")
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
        Case $Form1 =$GUI_CHECKED 
                        _API_SetLayeredWindowAttributes($Form1, 0xABCDEF)
                        
        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
 楼主| 发表于 2011-4-26 17:22:39 | 显示全部楼层
回复 2# 3mile



好像不是我想要的效果啊  我要的是类似这样的


本帖子中包含更多资源

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

×
发表于 2011-4-26 20:49:20 | 显示全部楼层
楼主,这个控件本身好像就不能叠加
如果你用的是KODA 你会发现,其实两个叠加的label其实都是建立在form上的
你给的图片也不是label叠加的例子啊
 楼主| 发表于 2011-4-26 22:55:36 | 显示全部楼层
回复 4# love5173


    那他的效果是怎么实现的啊?
发表于 2011-4-26 22:58:10 | 显示全部楼层
本帖最后由 love5173 于 2011-4-26 22:59 编辑

回复 5# cumtljj
看的未必准,看起来外面是个Group,中间上面是张图片,图片下面应该就是你说的label了,label外面又包了一层Group
 楼主| 发表于 2011-4-27 11:45:43 | 显示全部楼层
回复 6# love5173


    我试试看 这搞得也太多了点啊
 楼主| 发表于 2011-4-27 11:45:47 | 显示全部楼层
回复 6# love5173


    我试试看 这搞得也太多了点啊
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-23 18:39 , Processed in 0.081188 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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