一下代码抽取于我的软件,可供楼主参考public override Image OnSaveAsPicture()
{
Rectangle rect=Common.Zoom(this.Pool.PoolRectangle,this.Context.Host.Zoom);
Graphics grp=this.Context.Host.CreateGraphics(); 
IntPtr sourceHdc=new  IntPtr();
sourceHdc=grp.GetHdc();  //创建一个和图形源匹配的普通DC
IntPtr hdcCompatible =new IntPtr();
hdcCompatible=WIN32API.CreateCompatibleDC(sourceHdc);
 
 
//创建一个内存位图
IntPtr hbm=new IntPtr();
hbm =WIN32API.CreateCompatibleBitmap(sourceHdc, 
WIN32API.GetDeviceCaps(sourceHdc,WIN32API.HORZRES),  
WIN32API.GetDeviceCaps(sourceHdc, WIN32API.VERTRES)); 
 
 
//把内存位图选入绘图设备
WIN32API.SelectObject(hdcCompatible, hbm);
 
//拷贝图像
// Common.BitBlt(hdcCompatible, 0,0, 1024, 768,  sourceHdc,  0,0, WIN32API.SCRCOPY) ; 

 
if (rect==Rectangle.Empty)
{
rect=new Rectangle(new Point(0,0),new  Size(this.Context.Host.ClientSize.Width,this.Context.Host.ClientSize.Height));
}WIN32API.StretchBlt(hdcCompatible,rect.X,rect.Y,rect.Width ,rect.Height,sourceHdc,rect.X ,rect.Y,
rect.Width,
rect.Height,WIN32API.SCRCOPY ); 
 
Image img=Image.FromHbitmap(hbm);
 
System.IO.FileStream fs=System.IO.File.Create(@"c:\xxx.jpg");  
 
img.Save(fs,ImageFormat.Jpeg);

fs.Close();  grp.ReleaseHdc(sourceHdc); grp.Dispose();
  return img;
}