Z
zhaozhu
Unregistered / Unconfirmed
GUEST, unregistred user!
在绘图的时候出现问题,不能任意拖动图形大小,代码如下:
自己写的代码老是只能确定矩形的右下点,请问要怎么样确定左上点,达到任意拖动图形大小!~
private
flag:boolean;
fp,fp1:tpoint;
a,b,x,y: Integer;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if flag=false then
begin
flag:=true;
end
else
begin
canvas.rectangle(a,b,x,y);
flag:=false;
end;
end;
procedure TForm1.FormDblClick(Sender: TObject);
begin
fp.X:=x;
fp.Y:=y;
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
fp1.X:=a;
fp1.Y:=b;
end;
麻烦高手指点!~~~~~~~~~~~~~~~谢谢!
自己写的代码老是只能确定矩形的右下点,请问要怎么样确定左上点,达到任意拖动图形大小!~
private
flag:boolean;
fp,fp1:tpoint;
a,b,x,y: Integer;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if flag=false then
begin
flag:=true;
end
else
begin
canvas.rectangle(a,b,x,y);
flag:=false;
end;
end;
procedure TForm1.FormDblClick(Sender: TObject);
begin
fp.X:=x;
fp.Y:=y;
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
fp1.X:=a;
fp1.Y:=b;
end;
麻烦高手指点!~~~~~~~~~~~~~~~谢谢!