怎样从一点开始拖动鼠标成一个圆或长方形,就像一些画图软件那样:)超值奉上80分(80分)

C

cc1219

Unregistered / Unconfirmed
GUEST, unregistred user!
怎样从一点开始拖动鼠标成一个圆或长方形,就像一些画图软件那样:)
请给出程序或发到我的邮箱上love-mail-chen@163.net
非常感谢!
 
implementation
{$R *.DFM}
var
drawing:Boolean=false;
oPoint,sPoint:TPoint;
procedure TForm1.FormMouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
begin
spoint:=Point(x,y);
opoint:=sPoint;
drawing:=true;
Canvas.Brush.Style := bsclear;
Canvas.Pen.Style := psDot;
Canvas.Pen.Mode :=pmNotXor;
end;

procedure TForm1.FormMouseMove(Sender: TObject;
Shift: TShiftState;
X,
Y: Integer);
begin
if not(drawing) then
exit;
canvas.Ellipse(spoint.x,spoint.y,opoint.x,opoint.y);
canvas.Ellipse(spoint.x,spoint.y,x,y);
oPoint:=point(x,y);
end;

procedure TForm1.FormMouseUp(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
begin
if not(drawing) then
exit;
canvas.Ellipse(spoint.x,spoint.y,opoint.x,opoint.y);
Canvas.Pen.Style := psSolid;
canvas.Ellipse(spoint.x,spoint.y,x,y);
Drawing:=false;
end;

end.
 
咦,这不是vc++版吗?怎么也能用Delphi回答?
 
我说的怎样从一点开始拖动鼠标成一个圆或长方形,就像一些画图软件那样。能用Vc++给出程序吗?本人急用,谢谢:)
 
获得鼠标位置,用rectangle函数直接画
 
顶部