马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
procedure TfrmCanvas.imgImageMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
with imgImage do
begin
oldx := x;
oldy := y;
Canvas.Brush.Style := bsClear;//画刷填充方式
Canvas.Pen.Style := psDot; //线条类型
Canvas.Pen.Mode := pmXor;
Canvas.Pen.Color := clRed;
rold := Rect(0, 0, 0, 0); //创建一个矩形对象
end;
if ssright in Shift then
begin
imgImage.Picture.Bitmap := nil;
end;
end;
procedure TfrmCanvas.imgImageMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
if not (ssleft in Shift) then Exit;
with imgImage do
begin
Canvas.Rectangle(rold);//Rectangle根据提供的两个点或一个矩形区域绘制一个矩形
Canvas.Rectangle(oldx, oldy, x, y);
rold := Rect(oldx, oldy, x, y);
end;
end;
procedure TfrmCanvas.imgImageMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
with imgImage do
begin
Canvas.Pen.Style := psSolid;
Canvas.Pen.Mode := pmCopy;
Canvas.Pen.Color := clRed;
Canvas.Rectangle(rold);
end;
end;
问题是在MouseMove事件中 Canvas.Rectangle(rold);//Rectangle根据提供的两个点或一个矩形区域绘制一个矩形
Canvas.Rectangle(oldx, oldy, x, y);
rold := Rect(oldx, oldy, x, y);
主要是实现了什么,求告知。。。谢谢!!! |