如何保存PaintBox上的图片为BMP格式 (100分)

D

Deang

Unregistered / Unconfirmed
GUEST, unregistred user!
我在PaintBox的canvas上绘制的图片怎样才能保存成BMP文件?
Canvas中并没有像Image中有savetofile呀?
 
利用save对话框,试试
 
我又一个image上的图片保存要吗?
 
推一下,谁有好的解决办法?
 
procedure TForm1.Button1Click(Sender: TObject);
var
bmp:TBitmap;
r:TRect;
begin
bmp := TBitmap.Create;
bmp.Width := PaintBox1.Width;
bmp.Height := PaintBox1.Height;
r:=Rect(Paintbox1.Left,Paintbox1.Top,Paintbox1.Width,Paintbox1.Height);
PaintBox1.Canvas.MoveTo(0,0);
PaintBox1.Canvas.LineTo(Paintbox1.Width,Paintbox1.Height);
PaintBox1.Canvas.Ellipse(10,10,120,140);
try
bmp.Canvas.CopyRect(R,PaintBox1.Canvas,R);
bmp.SaveToFile('c:/AA.bmp');
finally
bmp.Free;
end;
end;
 
接受答案了.
 

Similar threads

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