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
Jemand Idee ?
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
Jemand Idee ?
Mach es ohne Labels und verwende GDI+ mit einem mehrschitigem Fenster. Das sieht nachher wesentlich besser aus als ein Label.
Hier ist ein Beispiel des Prinzips: https://autoit.de/index.php?page=Thread&postID=211221.
Bin nich so mit GDI+ vertraut
Sosnt noch Ideen ?
Sonst werde ich mich dochmal mit GDI+ auseinandersetzen
Naja. So sieht das ganze mit einem normalen Label aus...
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <WinAPI.au3>
$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()
While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Meinen Vorschlag umzusetzen sollte aber nicht allzu schwer sein. Außerdem gibt es ja noch dieses Forum falls du nicht weiterkommst ;).
Ok so klappts
Werde mal sehen wie mein vorhaben damit aussehen wird sonst gehts eben doch an GDI+
Hier was von mir:
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")
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)
Func _Exit()
GUIDelete()
Exit
EndFunc
Oder so was:
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
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)
Func _Exit()
GUIDelete()
Exit
EndFunc
Gruß,
UEZ