我曾经写过一段:
你看如下函数:
procedure Get2Bmp(Com:TWinControl;var bmp:TBitmap);
var sCanvas:TCanvas;
begin
sCanvas:=TCanvas.Create;
try
sCanvas.Handle:=GetDC(Com.Handle);
bmp.width:=Com.width;
bmp.Height:=Com.Height;
bmp.Canvas.CopyRect(Rect(0,0,Bmp.Width-1,Bmp.Height-1),sCanvas,Rect(0,0,Bmp.Width-1,Bmp.Height-1));
finally
sCanvas.Free;
sCanvas:=nil;
end;
end;
//如下调用
Get2Bmp(Ole,PublicBmp);