Hier mal nen Sourceschnippsel, sollte alles selbsterklärend sein
Delphi-Quellcode:
[...]
type
TForm1 = class(TForm)
[...]
FMDown: Boolean;
{ Private declarations }
[...]
procedure TForm1.FormCreate(Sender: TObject);
begin
Brush.Style := bsClear;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if FMDown then Canvas.LineTo(x, y);
end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
fMDown := True;
Canvas.MoveTo(x, y);
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
fMDown := False;
end;