请问把当前FORM保存为一个图片,怎样才能保存图片时可以请别人选择放在什么位置?? 请问把当前FORM保存为一个图片,怎样才能保存图片时可以请别人选择放在什么位置?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 if savedialog1.execute thenbegin //savedialog1.filename就是要保存的图片文件名 {...保存图片的代码}end;//SAVEDIALOG控件在DIALOG面板中 好像保存form为图片,能不能用cavas啊? 可以是Canvas的使用TBitMap做临时对象保存图片在处理就是了 type LogPal = record lpal : TLogPalette; dummy:Array[0..255] of TPaletteEntry; end; procedure TMyControl.SaveAsBmp(fileName: TFileName);var Source: TComponent; SysPal : LogPal; tempCanvas: TCanvas; sourceRect, destRect: TRect; image2save: TImage; notUsed: HWND;begin tempCanvas := TCanvas.Create; try tempCanvas.Handle := GetDeviceContext(notUsed); image2save:=TImage.create(self); try with image2save do begin Height := Self.Height; Width := Self.Width; destRect := Rect(0,0,Width,Height); sourceRect := destRect; Canvas.CopyRect(destRect,tempCanvas,sourceRect); SysPal.lPal.palVersion:=$300; SysPal.lPal.palNumEntries:=256; GetSystemPaletteEntries(tempCanvas.Handle,0,256,SysPal.lpal.palPalEntry); Picture.Bitmap.Palette:= CreatePalette(Syspal.lpal); end; image2save.Picture.SaveToFile(fileName); finally image2save.Free; end; finally tempCanvas.Free; end;end; 选择savepicture组件,执行顶楼Drate(小虫) 的代码就可以了, 用savedialog要默认什么意思?是不是savedialog1.FileName:=your_pic_name 扩展名吧?设置DefaultExt属性。 线程访问vcl 请问这句代码是什么意思? 把贴子都结,散分!! 输入法转换问题 悬赏100分了 急!!!!!!!!!!!11 如何防止图象被截取?怎样用 API 的方式实现用鼠标拖动控件? 一个简单问题,但是不好下手,大家来帮忙啊!(关于在DBGrid中编辑数据) 我的Delphi为什么总是提不高????? 做程序FLASH窗口的最佳方法? delphi中有没有类似vb中split的函数 请大家讨论:现在是用delphi5呢,还是用delphi6好呢? 出错问题 高分相送:哪们仁兄有ModelMaker的中文资料?
begin
//savedialog1.filename就是要保存的图片文件名
{...保存图片的代码}
end;
//SAVEDIALOG控件在DIALOG面板中
使用TBitMap做临时对象保存图片在处理就是了
LogPal = record
lpal : TLogPalette;
dummy:Array[0..255] of TPaletteEntry;
end; procedure TMyControl.SaveAsBmp(fileName: TFileName);
var
Source: TComponent;
SysPal : LogPal;
tempCanvas: TCanvas;
sourceRect, destRect: TRect;
image2save: TImage;
notUsed: HWND;
begin
tempCanvas := TCanvas.Create;
try
tempCanvas.Handle := GetDeviceContext(notUsed);
image2save:=TImage.create(self); try
with image2save do
begin
Height := Self.Height;
Width := Self.Width;
destRect := Rect(0,0,Width,Height);
sourceRect := destRect;
Canvas.CopyRect(destRect,tempCanvas,sourceRect);
SysPal.lPal.palVersion:=$300;
SysPal.lPal.palNumEntries:=256;
GetSystemPaletteEntries(tempCanvas.Handle,0,256,SysPal.lpal.palPalEntry);
Picture.Bitmap.Palette:= CreatePalette(Syspal.lpal); end;
image2save.Picture.SaveToFile(fileName);
finally
image2save.Free;
end;
finally
tempCanvas.Free;
end;
end;
是不是
savedialog1.FileName:=your_pic_name