Einzelnen Beitrag anzeigen

Sunshine

Registriert seit: 1. Feb 2003
Ort: HN
1 Beiträge
 
#5

Re: [nonVCL] Farbe von STATIC bei Mausbewegung ändern

  Alt 11. Feb 2007, 18:44
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;
  Mit Zitat antworten Zitat