我在image里用image1.canvas.lineto(x,y);画了几条线后,想通过按钮清空这几条线,怎么做到啊?(20分)

  • 主题发起人 主题发起人 xiaoxiami1
  • 开始时间 开始时间
X

xiaoxiami1

Unregistered / Unconfirmed
GUEST, unregistred user!
我在image里用image1.canvas.lineto(x,y);画了几条线后,想清空这几条线,怎么做到啊?
 
问的太多了 异或 找以前的资料
 
用Color去FillRect一下。
 
pen.mode:=pmXor

再画一次!
 
pen.mode:=pmNotXor;
 
保存以前的图象,再画出
 
Image1.Canvas.FillRect(Image1.Canvas.ClipRect);
 
卷起千堆雪tyn大侠:
真乃绝代高手!
 
不知道我的程序为什么不行!
开始时装了一幅图片(用的fillrect),
Form1.Repaint;
pic1:=Rect(0,0,image1.width,image1.height);
image1.Canvas.FillRect(pic1);
image1.Transparent := True; //
image1.Canvas.Pen.Color:=clRed; //
image1.Canvas.Pen.Style:=psSolid; //
image1.Canvas.Brush.Color:=clBtnFace; //
image1.Canvas.Brush.Style:=bsSolid;//设置属性;
BitMap1:=TBitMap.Create;
BitMap1.LoadFromFile('C:/WINNT/Web/Wallpaper/4.bmp');
Form1.image1.Canvas.stretchDraw(pic1,BitMap1);

现在要根据图片大小重装图片,所以用了一下语句:
Image1.Canvas.FillRect(Image1.Canvas.ClipRect);刷新
if (Bitmap1.Height>Image1.Height) and (bitmap1.Width<Image1.Width) then
begin
kx:=Bitmap1.Height div Image1.Height;
Dek:=Bitmap1.Width div kx;
left:=((Image1.Width-Dek) div 2);
top:=0;
right:=((Image1.Width+Dek) div 2);
bottom:=Image1.Height;
pic1:=Rect(left,top,right,bottom);
image1.Canvas.FillRect(pic1);运行这里就出错。
Image1.picture.BitMap.Assign(bitmap1);
end
else if (Bitmap1.Height<Image1.Height) and (bitmap1.Width>Image1.Width) then
begin
kx:=Bitmap1.Width div Image1.Width;
Dek:=Bitmap1.height div kx;
left:=0;
top:=((Image1.Height-Dek) div 2);;
right:=Image1.width;
bottom:=((Image1.height+Dek) div 2);
pic1:=Rect(left,top,right,bottom);
image1.Canvas.FillRect(pic1);
Image1.picture.BitMap.Assign(bitmap1);
end
else if (Bitmap1.Height>Image1.Height) and (bitmap1.Width>Image1.Width) then
begin
if (Bitmap1.Height div Image1.height)<(Bitmap1.Width div Image1.Width) then
begin
kx:=Bitmap1.Width div Image1.Width;
Dek:=Bitmap1.height div kx;
left:=0;
top:=((Image1.Height-Dek) div 2);;
right:=Image1.width;
bottom:=((Image1.height+Dek) div 2);
pic1:=Rect(left,top,right,bottom);
image1.Canvas.FillRect(pic1);
Image1.picture.BitMap.Assign(bitmap1);
end
else begin
kx:=Bitmap1.Height div Image1.Height;
Dek:=Bitmap1.Width div kx;
left:=((Image1.Width-Dek) div 2);
top:=0;
right:=((Image1.Width+Dek) div 2);
bottom:=Image1.Height;
pic1:=Rect(left,top,right,bottom);
image1.Canvas.FillRect(pic1);
Image1.picture.BitMap.Assign(bitmap1);
end;
end
else begin
left:=((Image1.width-bitmap1.width) div 2);
top:=((Image1.height-bitmap1.height) div 2);
right:=((Image1.width+bitmap1.width) div 2);
bottom:=((Image1.height+bitmap1.height) div 2);
Image1.Canvas.FillRect(pic1);
Image1.picture.Bitmap.Assign(bitmap1);
end;
不知道什么原因阿!!!
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
后退
顶部