Hi,
du must WM_CTLCOLORSTATIC abfangen. SetBkColor funktioniert irgendwie nicht bei Static Controls.
Also ungefähr so:
Delphi-Quellcode:
begin
Result := TRUE;
case uMsg of
...
WM_MOUSEMOVE:
begin
if ((GetCapture = hWnd) and GetCursorPos(pt)) then
begin
// pixelcolor
clr := GetPixel(AppDC, pt.x, pt.y);
end;
end;
WM_CTLCOLORSTATIC:
begin
brush := CreateSolidBrush(clr);
result := BOOL(brush);
end;