unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 =
class(TForm)
procedure FormKeyDown(Sender: TObject;
var Key: Word;
Shift: TShiftState);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormKeyUp(Sender: TObject;
var Key: Word;
Shift: TShiftState);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
strgpressed,keypressed:Boolean ;
Ortho_korrdinate:Integer ;
implementation
{$R *.dfm}
procedure TForm1.FormKeyDown(Sender: TObject;
var Key: Word;
Shift: TShiftState);
begin
if strgpressed=False
then begin
strgpressed:= Shift=[ssCtrl] ;
Ortho_korrdinate:=Mouse.CursorPos.X ;
end ;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if (strgpressed)
and (keypressed)
then begin SetCursorpos(Ortho_korrdinate,Mouse.CursorPos.Y);
Canvas.LineTo(X, Y);
end;
end;
procedure TForm1.FormKeyUp(Sender: TObject;
var Key: Word;
Shift: TShiftState);
begin
strgpressed:=False ;
end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if keypressed=False
then begin
keypressed:=True ;
Ortho_korrdinate:=Mouse.CursorPos.X ;
Canvas.MoveTo(X, Y);
end ;
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
keypressed:=False ;
end;
end.