Hardware Delphi

Title: How to draw a bounding box with the mouse ?
Question: How can I draw a bounding box with the mouse ?
Answer:
The bounding mouse box can be useful in some graphic applications, here is the method for it:
// first declare there variables
FirstPoint : Tpoint;
CurrentPoint : Tpoint;
stilldown : boolean;
// write the following procedures:
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if button = mbleft then begin
FirstPoint.x := X;
CurrentPoint.x := X;
FirstPoint.y := Y;
CurrentPoint.y := Y;
stilldown := true;
end;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if stilldown then begin
Self.Canvas.pen.Mode := pmNot;
Self.Canvas.pen.width := 4;
Self.Canvas.brush.Style := bsclear;
Self.Canvas.Rectangle ( FirstPoint.x ,FirstPoint.y ,CurrentPoint.x , CurrentPoint.y );
CurrentPoint.x := X ;
CurrentPoint.y := Y;
Self.Canvas.Rectangle ( FirstPoint.x ,FirstPoint.y ,CurrentPoint.x , CurrentPoint.y );
end;
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if (stilldown) and ( button = mbleft) then begin
stilldown := false;
Self.Canvas.pen.Mode := pmNot;
Self.Canvas.pen.width := 4;
Self.Canvas.brush.Style := bsclear;
Self.Canvas.Rectangle ( FirstPoint.x ,FirstPoint.y ,CurrentPoint.x , CurrentPoint.y );
end;
end;