Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi STATIC Control transparent? (https://www.delphipraxis.net/54992-static-control-transparent.html)

Rastaman 14. Okt 2005 16:05


STATIC Control transparent?
 
Moin. Ihr kennt doch sicher alle die Eigenschaft "Transparent" vom TLabel.
Weiss jemand wie ich das auch auf ne STATIC Control anwenden kann?
Also STATIC und nich TStaticText :stupid:

Thx!

SirThornberry 14. Okt 2005 17:03

Re: STATIC Control transparent?
 
eine Ordentliche Transparenz kannst du darauf nur Bedingt anwenden da TStatic ein eigenes Fenster ist (handle) und TLabel nur ein Control welches sich auf die Canvas des Parenz malt.

Um deinen Effekt zu erreichen musst du WM_ERASEBKGND abfangen und die Message verwerfen. Und dann musst du bei den CreateParams zum Style ws_WS_EX_TRANSPARENT hinzufügen. Am besten du suchst mal wie man ein Panel Transparent bekommt (gabs öfters schon) und genau so geht es auch bei einem TStaticText (sollte es zumindest)

Rastaman 14. Okt 2005 17:12

Re: STATIC Control transparent?
 
Sie heisst WM_ERASEBKGND (Nur nachgeguggt, nich, dass Olli wieder denkt, dass ich Klugscheisse :mrgreen:)
Aber wie verwerfe ich den Messages?

SirThornberry 14. Okt 2005 17:14

Re: STATIC Control transparent?
 
laut msdn "verwirfst" du die Message in dem du als Result einen Wert ungleich 0 beim Messagehandler zurück gibst.
Delphi-Quellcode:
procedure TStaticText.WMEraseBkgnd(var AMsg: TWMEraseBkgnd);
begin
  AMsg.result := 1;
end;
Aber wie geschrieben, einfach danach suchen wie es beim panel gemacht wird und du hast die lösung.

Rastaman 14. Okt 2005 17:17

Re: STATIC Control transparent?
 
Zitat:

Zitat von Gerrit89
Also STATIC und nich TStaticText :stupid:

Zitat:

Zitat von SirThornberry
...und genau so geht es auch bei einem TStaticText (sollte es zumindest)

;)

SirThornberry 14. Okt 2005 17:18

Re: STATIC Control transparent?
 
Bei TStaticText gibt es doch eigentlich schon ein property Transparent (was bei mir aber irgendwie nicht funktioniert)

Rastaman 14. Okt 2005 17:20

Re: STATIC Control transparent?
 
Es geht aber nicht um TStaticText, sondern um STATIC :-D (keine VCL)

SirThornberry 14. Okt 2005 17:27

Re: STATIC Control transparent?
 
achso, wenns um Static geht hab ich ja schon gepostet wie es gehen sollte.
Dann musst du nicht die CreateParams überschreiben sondern gleich beim erzeugen beim Style das WS_EX_TRANSPARENT mit übergeben.

Rastaman 14. Okt 2005 17:35

Re: STATIC Control transparent?
 
Da is leider kein Unterschied zu vorher :(

Zitat:

WS_EX_TRANSPARENT
Specifies that a window created with this style should not be painted until siblings beneath the window (that were created by the same thread) have been painted. The window appears transparent because the bits of underlying sibling windows have already been painted.

To achieve transparency without these restrictions, use the SetWindowRgn function.
Versteh ich nich so ganz ...

//Edit: Gibts auch sowas wie AutoSize fürn STATIC?

SirThornberry 14. Okt 2005 17:51

Re: STATIC Control transparent?
 
Zitat:

Zitat von Gerrit89
Da is leider kein Unterschied zu vorher :(

Zitat:

WS_EX_TRANSPARENT
Specifies that a window created with this style should not be painted until siblings beneath the window (that were created by the same thread) have been painted. The window appears transparent because the bits of underlying sibling windows have already been painted.

To achieve transparency without these restrictions, use the SetWindowRgn function.
Versteh ich nich so ganz ...

//Edit: Gibts auch sowas wie AutoSize fürn STATIC?

dort steht in etwa das zuerst der Untergrund gemalt wird und danach erst dann das Fenster. Dadurch hast du den Untergrund von dem Fenster darunter.


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:45 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz