URL: https://www.overclockers.at/coding-stuff/transparentes_label_c_winapi_40386/page_1 - zur Vollversion wechseln!
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 ...
funktioniert endlich
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
exakt diese variante hab ich xxxx mal versucht, allerdings immer ohne dem return [...] ... da lag der hund begraben
Tja, hast du wohl nicht genau genug gelesen
die return-zeile stand ja nie dabei ... sonst wärs ja kein problem gwesn
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."
overclockers.at v4.thecommunity
© all rights reserved by overclockers.at 2000-2025