将图片保存为bmp格式的,图片有点大;
代码如下:
var
dc:HDC;
fullCanvas:TCanvas;
bm:TBitmap;
dlg1: TSavePictureDialog;
begin
dc:=GetDC(0);
fullCanvas:=TCanvas.Create;
dlg1:=TSavePictureDialog.Create(nil);
bm:=TBitmap.Create;
fullCanvas.Handle:=dc;
try
if dlg1.Execute then
begin
bm.Width:=Screen.Width;
bm.Height:=Screen.Height;
bm.Canvas.CopyRect(Rect(0,0,bm.Width,bm.Height),fullCanvas,Rect(0,0,Screen.Width,Screen.Height));
bm.SaveToFile(dlg1.FileName+'.bmp');