急问一个图形保存问题 我在PAINTBOX控件上作图,该怎么保存?我试着将PAINTBOX控件上的图拷贝到IMAGE上,可是只能保存当前可见的部分,滚动条以外的部分不能保存,清各位帮忙了,谢谢!急! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 是你保存方法不对吧,我以前也遇到过,后改成下面的形式。unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;type TForm1 = class(TForm) PaintBox: TPaintBox; Button1: TButton; Image: TImage; procedure Button1Click(Sender: TObject); procedure PaintBoxPaint(Sender: TObject); private { Private declarations } procedure DrawGrahpic(ACanvas:TCanvas); public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.DrawGrahpic(ACanvas: TCanvas);begin with ACanvas do begin MoveTo(10,10); LineTo(10,100); LineTo(100,100); end;end;procedure TForm1.Button1Click(Sender: TObject);var bmp :TBitmap;begin bmp :=TBitmap.Create; bmp.PixelFormat:=pf4bit; bmp.Width :=PaintBox.Width; bmp.Height :=PaintBox.Height; ///关键是下面这句,一定要和PaintBox的OnPaint上画图函数一样 DrawGrahpic(bmp.Canvas); Image.AutoSize:=True; Image.Stretch:=True; Image.Picture.Bitmap.Assign(bmp); bmp.Free; Image.Picture.SaveToFile('c:\a.bmp'); //保存end;procedure TForm1.PaintBoxPaint(Sender: TObject);begin DrawGrahpic(PaintBox.Canvas);end;end. Socket 缓冲区空间不足 控制台图标 请问自己提问的帖子在新版如何查? 模板安装程序---->感觉有点难 小弟要考软件设计师-求建议 delphi功能如此强大,可这么一个简单的问题始终无法解决? 如何使listbox的所选项的背景色去掉,而所选 项的字体变成红色,现在所选项默认的是蓝色背景和白色字体 请问在DELPHI中怎么编译发行版啊? 如何自己删除自己 现在实现了两个listbox的相互拖拽 怎么实现禁止他们的自身拖拽? 50分 在线 可行方案 立马给分 为什么要使用session组件,有什么好处? 求一个使用TcpClient和TcpServer的简单例子!
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
PaintBox: TPaintBox;
Button1: TButton;
Image: TImage;
procedure Button1Click(Sender: TObject);
procedure PaintBoxPaint(Sender: TObject);
private
{ Private declarations }
procedure DrawGrahpic(ACanvas:TCanvas);
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.DrawGrahpic(ACanvas: TCanvas);
begin
with ACanvas do
begin
MoveTo(10,10);
LineTo(10,100);
LineTo(100,100);
end;
end;procedure TForm1.Button1Click(Sender: TObject);
var
bmp :TBitmap;
begin
bmp :=TBitmap.Create;
bmp.PixelFormat:=pf4bit;
bmp.Width :=PaintBox.Width;
bmp.Height :=PaintBox.Height; ///关键是下面这句,一定要和PaintBox的OnPaint上画图函数一样
DrawGrahpic(bmp.Canvas); Image.AutoSize:=True;
Image.Stretch:=True;
Image.Picture.Bitmap.Assign(bmp);
bmp.Free;
Image.Picture.SaveToFile('c:\a.bmp'); //保存
end;procedure TForm1.PaintBoxPaint(Sender: TObject);
begin
DrawGrahpic(PaintBox.Canvas);
end;end.