unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 =
class(TForm)
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
keypressed: Boolean ;
Ortho_korrdinate: Integer ;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
P: TPoint;
begin
if keypressed
then begin
P.X := Ortho_korrdinate;
P.Y := Y;
P := Self.ClientToScreen(P);
SetCursorpos(P.X, P.Y);
Canvas.LineTo(Ortho_korrdinate, Y);
end;
end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
keypressed := ssCtrl
in Shift;
//if keypressed then begin // braucht man hier nicht unbedingt
Ortho_korrdinate := X;
Canvas.MoveTo(X, Y);
//end;
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
keypressed := False;
end;
end.