Einzelnen Beitrag anzeigen

Volker Z.

Registriert seit: 4. Dez 2012
Ort: Augsburg, Bayern, Süddeutschland
419 Beiträge
 
Delphi XE4 Ultimate
 
#2

AW: Cursor auf Komponente legen

  Alt 12. Mai 2014, 23:08
Hallo,

suchst Du vielleicht etwas in der Richtung?
Delphi-Quellcode:
type
  TCursorPos = (cpTopLeft, cpTopRight, cpBottomLeft, cpBottomRight, cpCentered);

procedure SetControlCursorPos (const Form : TForm; const Control : TControl; const CursorPos : TCursorPos);
var
  p : TPoint;
begin
  case CursorPos of
    cpTopLeft : p := Form.ClientToScreen (Point (Control.Left, Control.Top));
    cpTopRight : p := Form.ClientToScreen (Point (Control.Left + Control.Width, Control.Top));
    cpBottomLeft : p := Form.ClientToScreen (Point (Control.Left, Control.Top + Control.Height));
    cpBottomRight : p := Form.ClientToScreen (Point (Control.Left + Control.Width, Control.Top + Control.Height));
    cpCentered : p := Form.ClientToScreen (Point (Control.Left + Control.Width div 2, Control.Top + Control.Height div 2));
  end;

  SetCursorPos (p.X, p.Y)
end;

procedure TFmain.Button1Click(Sender: TObject);
begin
  SetControlCursorPos (Self, WebBrowser1, cpBottomLeft)
end;
Gruß
Volker Zeller
  Mit Zitat antworten Zitat