截取到的是屏幕大小的bitmap,我需要修改其大小,并转换为JPEG.我代码如下,可是需要从文件中转function TForm1.ResizeImage(SourceBitmap:TBitmap):TJPEGimage;
var tmpBitmap:TBitmap;
    tmpJPEG:TJPEGimage;
    Dest:TRect;
begin
 tmpBitmap:=TBitmap.Create;
 tmpBitmap.Width:=320;
 tmpBitmap.Height:=240; with Dest do
  begin
   Left:=0;
   Top:=0;
   Right:=tmpBitmap.Width;
   bottom:=tmpbitmap.Height;
  end; tmpBitmap.Canvas.StretchDraw(Dest,SourceBitmap);
 tmpJPEG:=TJPEGimage.Create;
 tmpJPEG.Assign(tmpBitmap);
 result:=tmpJPEG;
end;procedure TForm1.ScreenCap;
var RectWidth,RectHeight:integer;
    SourceDC,DestDC,Bhandle:integer;
    Bitmap,Bitmap2:TBitmap;
    NewJpeg:TJPEGimage;
begin
 RectWidth:=Screen.Width;
 RectHeight:=Screen.Height;
 SourceDC:=CreateDC('DISPLAY','','',nil);
 DestDC:=CreateCompatibleDC(SourceDC);
 Bhandle:=CreateCompatibleBitmap(SourceDC,RectWidth,RectHeight);
 SelectObject(DestDC,Bhandle);
 BitBlt(DestDC,0,0,RectWidth,RectHeight,SourceDC,LeftPos,TopPos,SRCCOPY);
 Bitmap:=TBitmap.Create;
 Bitmap2:=TBitmap.Create;
 NewJpeg:=TJPEGimage.Create;
 Bitmap.Handle:=BHandle;
 Bitmap.SaveToFile('d:\temp.bmp');
 Bitmap2.LoadFromFile('d:\temp.bmp');
 deletefile('d:\temp.bmp');
 NewJpeg.Assign(ResizeImage(Bitmap2));
 NewJpeg.SaveToStream(BmpStream);
 BmpStream.Position:=0;
 LeftSize:=BmpStream.Size;
 Bitmap.Free;
 NewJpeg.Free;
 DeleteDC(DestDC);
 ReleaseDC(Bhandle,SourceDC);
end;