Zum Inhalt springen

Empfohlene Beiträge

Geschrieben

Hallo miteinander,

hab nach langer Zeit mal wieder ein Problem..

Wie mache ich die Form transparent? :confused:

Über form1.BackColor = XXX,

kann ich der Form sagen, daß sie die Farbe des Desktops übernehmen soll.

Wenn aber ein Wallpaper als Desktophintergrund genutzt wird, übernimmt die Form totzdem die Farbe des Desktops.

-> also nicht wirklich transparent... :(

Kann mir jemand helfen mit Tips, Code oder wenigstens n Schubser in die richtige Richtung? :D

Geschrieben
öhm visible= false?

oder willst du das ganze halbtransparent machen?

Auf der Form ist noch ein Label, daß die aktuelle CPU-Geschwindikeit anzeigt.

Der Hintergrund des Labels ist Transparent.

Die Form wird gestartet, im Label zeigts die aktuelle CPU-Geschwindikeit und wird nach 10s automatisch beendet.

Die Form wird mit BorderStyle 0 gestartet, hat also nicht mal ne Leiste mit den 3 Standard-Buttons (min, max, X).

Will nur das alles Transparent ist und nur die CPU-Geschwindikeit zu sehen ist. :(

Geschrieben

Offensichtlich hast du noch keine Google-Suche zu diesem Thema versucht, sonst wärst du beim ersten Link zu

http://spotlight.de/zforen/amvb/m/amvb-1068394939-82.html gekommen, der sagt:

Private Declare Function GetWindowLong Lib "user32" _

   Alias "GetWindowLongA" (ByVal hWnd As Long, _

   ByVal nIndex As Long) As Long


Private Declare Function SetWindowLong Lib "user32" _

Alias "SetWindowLongA" (ByVal hWnd As Long, _

ByVal nIndex As Long, ByVal dwNewLong As Long) As Long


Private Declare Function SetLayeredWindowAttributes _

Lib "user32" (ByVal hWnd As Long, _

ByVal crKey As Long, ByVal bAlpha As Byte, _

ByVal dwFlags As Long) As Long


Const LWA_COLORKEY = &H1

Const LWA_ALPHA = &H2

Const GWL_EXSTYLE = (-20)

Const WS_EX_LAYERED = &H80000

Const WS_EX_NOINHERITLAYOUT = &H100000



Private Sub Form_Load()

Dim hRslt As Long


hRslt = GetWindowLong(Me.hWnd, GWL_EXSTYLE)

hRslt = hRslt Or WS_EX_NOINHERITLAYOUT Or WS_EX_LAYERED

SetWindowLong Me.hWnd, GWL_EXSTYLE, hRslt


Me.BackColor = RGB(0, 255, 0)

SetLayeredWindowAttributes Me.hWnd, Me.BackColor, 0, LWA_COLORKEY


End Sub

Und du gibst ihm halt als alpha-Wert ... k.A. z.B. 50

Geschrieben
Offensichtlich hast du noch keine Google-Suche zu diesem Thema versucht, sonst wärst du beim ersten Link zu

http://spotlight.de/zforen/amvb/m/amvb-1068394939-82.html gekommen, der sagt:

Private Declare Function GetWindowLong Lib "user32" _

   Alias "GetWindowLongA" (ByVal hWnd As Long, _

   ByVal nIndex As Long) As Long


Private Declare Function SetWindowLong Lib "user32" _

Alias "SetWindowLongA" (ByVal hWnd As Long, _

ByVal nIndex As Long, ByVal dwNewLong As Long) As Long


Private Declare Function SetLayeredWindowAttributes _

Lib "user32" (ByVal hWnd As Long, _

ByVal crKey As Long, ByVal bAlpha As Byte, _

ByVal dwFlags As Long) As Long


Const LWA_COLORKEY = &H1

Const LWA_ALPHA = &H2

Const GWL_EXSTYLE = (-20)

Const WS_EX_LAYERED = &H80000

Const WS_EX_NOINHERITLAYOUT = &H100000



Private Sub Form_Load()

Dim hRslt As Long


hRslt = GetWindowLong(Me.hWnd, GWL_EXSTYLE)

hRslt = hRslt Or WS_EX_NOINHERITLAYOUT Or WS_EX_LAYERED

SetWindowLong Me.hWnd, GWL_EXSTYLE, hRslt


Me.BackColor = RGB(0, 255, 0)

SetLayeredWindowAttributes Me.hWnd, Me.BackColor, 0, LWA_COLORKEY


End Sub

Und du gibst ihm halt als alpha-Wert ... k.A. z.B. 50

Isch habe gegoogelt! :) ,

Habe auch was gefunden, aber leider nicht so ganz das richtige bzw. ich hatte Probleme dies zuverstehen und anzupassen. :cool:

Ups.. was vergessen..

DANKE DIR!!!! :uli

Genau das was ich gesucht habe! :)

Erstelle ein Benutzerkonto oder melde Dich an, um zu kommentieren

Du musst ein Benutzerkonto haben, um einen Kommentar verfassen zu können

Benutzerkonto erstellen

Neues Benutzerkonto für unsere Community erstellen. Es ist einfach!

Neues Benutzerkonto erstellen

Anmelden

Du hast bereits ein Benutzerkonto? Melde Dich hier an.

Jetzt anmelden

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...