In run time, how can I draw that box line for selecting multiple objects for moving/resizing, etc..
Does anybody have that code? need urgent
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormCreate(Sender: TObject);
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
Flag: Boolean;
StartPoint, PrvPoint: TPoint;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Flag:= False;
Canvas.Brush.Style:= bsClear;
Canvas.Pen.Mode:= pmNotXor;
Canvas.Pen.Style:= psDot;
end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
If Button = mbLeft then
begin
Flag:= True;
StartPoint.X:= X;
StartPoint.Y:= Y;
PrvPoint.X:= X;
PrvPoint.Y:= Y;
end;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
If Flag then
begin
Canvas.Rectangle(StartPoint.X, StartPoint.Y, PrvPoint.X, PrvPoint.Y);
Canvas.Rectangle(StartPoint.X, StartPoint.Y, X, Y);
PrvPoint.X:= X;
PrvPoint.Y:= Y;
end;
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then
Flag:= False;
end;
end.
Users browsing this forum: Bing [Bot] and 0 guests