Einzelnen Beitrag anzeigen

Benutzerbild von stoxx
stoxx

Registriert seit: 13. Aug 2003
1.111 Beiträge
 
#5

Re: Cursor auf der FormTitelleiste ändern?

  Alt 14. Feb 2009, 15:04
da bleibt Dir nix anderes übrig, als selber zu prüfen, ob Du in der Titelleiste bist.

also im OnMouseMoveEvent (sofern das in der Titelleiste noch geliefert wird .. weiß ich jetzt nicht)
prüfst Du, ob drin ...
ansonsten müsstest Du noch das onmouseleave Event prüfen und dann einen Timer starten oder so ..
oder einen kleinen Mousehook..


dann fragst Du also im MouseMoveEvent mit GetCursorPos die Koordinaten ab. und prüfst mit folgender Funktion ob Du drin bist ...

und dann änderst Du Deinen Cursor manuell ...

Delphi-Quellcode:
//==============================================================================
// Prüft ob die Mauskoordinaten in der Titelleiste sind
// entwickelt für XP .. koennte sein, dass es in Vista noch paar Variablen mehr gibt

function IsMouseInCaption(WND : HWND; x, y : Integer) : boolean;
var WindowRect : TRect;
    CaptRect : TRect;
    h, hBorder : Integer;
begin
  result := false;

  GetWindowRect(WND, WindowRect);


  CaptRect.Left := GetSystemMetrics(SM_CXEDGE);
  CaptRect.Top := GetSystemMetrics(SM_CYEDGE)+2;
  CaptRect.Right := WindowRect.right-WindowRect.Left-GetSystemMetrics(SM_CYEDGE);
  CaptRect.Bottom := GetSystemMetrics(SM_CYCAPTION)+GetSystemMetrics(SM_CYEDGE);


  h := GetSystemMetrics(SM_CYCAPTION);

  h := GetSystemMetrics(SM_CYCAPTION);
  hBorder := GetSystemMetrics(SM_CYSIZEFRAME);
  if (y <= (WindowRect.Top + h + hborder + 1)) and
     (y >= WindowRect.top) and
     (x >= WindowRect.Left) and
     (x <= WindowRect.Right)

        then result := true;

end; // IsMouseInCaption
Phantasie ist etwas, was sich manche Leute gar nicht vorstellen können.
  Mit Zitat antworten Zitat