'Fliegende' Labels = Transparenter Hintergrund der GUI

  • Wie kann ich Den Hintergrund einer GUI Transparent machen , sodass zb der Desktop darunter zu sehen ist ?
    Das es mit Buttons machbar ist kenne ich vom Bsp hier Forum jedoch würde ich es gerne Mit Labels haben :D

    Jemand Idee ?

    Einmal editiert, zuletzt von Aldi (12. Juli 2012 um 22:09)

  • Bin nich so mit GDI+ vertraut :D
    Sosnt noch Ideen ?

    Sonst werde ich mich dochmal mit GDI+ auseinandersetzen

  • Naja. So sieht das ganze mit einem normalen Label aus...

    Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    #include <WinAPI.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $hWnd_Main = GUICreate("Transparency Test", 200, 100, Default, Default, Default, $WS_EX_LAYERED)
    $cLabel = GUICtrlCreateLabel("This is a test", 50, 50)
    GUISetBkColor(0xFEDBCA, $hWnd_Main)
    _WinAPI_SetLayeredWindowAttributes($hWnd_Main, 0xFEDBCA)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    While True
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

    [/autoit]


    Meinen Vorschlag umzusetzen sollte aber nicht allzu schwer sein. Außerdem gibt es ja noch dieses Forum falls du nicht weiterkommst ;).

  • Ok so klappts :D
    Werde mal sehen wie mein vorhaben damit aussehen wird sonst gehts eben doch an GDI+

  • Hier was von mir:

    Spoiler anzeigen
    [autoit]


    Opt("GUIOnEventMode", 1)
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>
    Global Const $iTranparentColor = 0xDDDDDD
    Global Const $iW = 120
    Global Const $iH = 30
    Global Const $iX = @DesktopWidth / 2 - $iW / 2
    Global Const $iY = @DesktopHeight / 2 - $iH / 2
    Global Const $hGUI = GUICreate("", $iW, $iH, $iX, $iY, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST)
    Global Const $idLabel = GUICtrlCreateLabel("Label Demo", 0, 0, 120, 30)
    GUICtrlSetBkColor(-1, $iTranparentColor)
    GUICtrlSetColor(-1, 0x0000FF)
    GUICtrlSetFont(-1, 16, 400, 0, "Arial", 5)
    GUISetState()
    _WinAPI_SetLayeredWindowAttributes($hGUI, $iTranparentColor)
    GUISetOnEvent(-3, "_Exit")

    [/autoit] [autoit][/autoit] [autoit]

    Global $i = Random(-0xFFFFFF, 0, 1)
    Do
    WinMove($hGUI, "", $iX + Cos($i / 25) * 100, $iY + Sin($i / 20) * 80)
    $i += 1
    Until Not Sleep(20)

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    GUIDelete()
    Exit
    EndFunc

    [/autoit]

    Oder so was:

    Spoiler anzeigen
    [autoit]


    Opt("GUIOnEventMode", 1)
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>
    Global Const $iTranparentColor = 0xEEEEEE
    Global Const $iW = 310
    Global Const $iH = 100
    Global Const $iX = @DesktopWidth / 2 - $iW / 2
    Global Const $iY = @DesktopHeight / 2 - $iH / 2
    Global Const $sTxt = "Label Demo by UEZ"
    Global Const $iTxtLen = StringLen($sTxt)
    Global Const $iFontsize = 16

    [/autoit] [autoit][/autoit] [autoit]

    Global $i, $j
    Global $aTaskbar = WinGetPos("[CLASS:Shell_TrayWnd;INSTANCE:1]", "")
    Global Const $hGUI = GUICreate("", $iW, $iH, @DesktopWidth - $iW - $iTxtLen, @DesktopHeight - $iH - $aTaskbar[3], $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST + $WS_EX_COMPOSITED)
    GUISetBkColor($iTranparentColor, $hGUI)
    $aLetters = StringSplit($sTxt, "", 2)
    Global Const $ub = UBound($aLetters) - 1
    Global $aIDLabels[$ub + 1]
    Global $dx = 40, $dy = 40
    For $i = 0 To $ub
    $aIDLabels[$i] = GUICtrlCreateLabel($aLetters[$i], $dx, $dy, $iFontsize, 40)
    GUICtrlSetBkColor(-1, $iTranparentColor)
    GUICtrlSetColor(-1, 0x80)
    GUICtrlSetFont(-1, $iFontsize, 400, 0, "Arial", 5)
    $dx += $iFontsize
    Next
    GUISetState()
    _WinAPI_SetLayeredWindowAttributes($hGUI, $iTranparentColor)
    GUISetOnEvent(-3, "_Exit")
    $i = 0
    $dx = 40
    $s = 0
    $t = TimerInit()
    Do
    For $j = 0 To $ub
    GUICtrlSetPos($aIDLabels[$j], $dx, $dy + Sin($i / 50) * 36)
    $c = BitShift(0x80 + Sin($i / 50) * 80, -$s)
    GUICtrlSetColor($aIDLabels[$j], $c)
    $i += 18
    $dx += $iFontsize
    Next
    If TimerDiff($t) > 9999 Then
    $s += 8
    If $s > 16 Then $s = 0
    $t = TimerInit()
    EndIf
    $dx = 40
    Until Not Sleep(20)

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    GUIDelete()
    Exit
    EndFunc

    [/autoit]

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

    4 Mal editiert, zuletzt von UEZ (13. Juli 2012 um 11:27)