transparentes label @ C++ / WinAPI

Seite 1 von 1 - Forum: Coding Stuff auf overclockers.at

URL: https://www.overclockers.at/coding-stuff/transparentes_label_c_winapi_40386/page_1 - zur Vollversion wechseln!


FMFlash schrieb am 08.07.2002 um 12:36

hat es hier schon mal jemand vollbracht ein label über hintergrund bis auf den text transparent darzustellen?
ich durchforste jetzt nämlich schon seit 3 tagen msdn, google und ein dickes buch namens "programming windows" ... ohne nennenswerten erfolg

den hintergrund initialisiere ich wie folgt:

LOGBRUSH back;

back.lbStyle = BS_PATTERN;
back.lbHatch = (long) LoadImage (hInstance, "background.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);

wndclass.hbrBackground = CreateBrushIndirect (&back);


und hier das label:

hwndstatic = CreateWindow ( "static",
NULL,
WS_CHILD | WS_VISIBLE | ES_READONLY | ES_LEFT | ES_MULTILINE,
x, y,
xW, yW,
hwnd,
(HMENU) x,
((LPCREATESTRUCT) lParam)->hInstance,
NULL);

vielleicht liegen da ja auch fehler begraben ...


FMFlash schrieb am 08.07.2002 um 13:20

funktioniert endlich :D

alles was nötig war:

case WM_CTLCOLORSTATIC:
SetTextColor((HDC) wParam,RGB(0,0,255));
SetBkMode((HDC) wParam,TRANSPARENT);
return (LRESULT) GetStockObject (NULL_BRUSH);

in der callback fürs fenster :p
exakt diese variante hab ich xxxx mal versucht, allerdings immer ohne dem return [...] ... da lag der hund begraben


Ringding schrieb am 08.07.2002 um 15:06

Tja, hast du wohl nicht genau genug gelesen :)


FMFlash schrieb am 08.07.2002 um 15:55

die return-zeile stand ja nie dabei ... sonst wärs ja kein problem gwesn


Ringding schrieb am 08.07.2002 um 20:05

Also im Platform SDK steht's eh ganz normal bei WM_CTLCOLORSTATIC:

"Return Values
If an application processes this message, the return value is a handle to a brush that the system uses to paint the background of the static control."


FMFlash schrieb am 09.07.2002 um 12:58

:eek:




overclockers.at v4.thecommunity
© all rights reserved by overclockers.at 2000-2025