To 我没有发现在.net中有可用的的函数可以调用,谁知道用.net怎样实现?用Graphics.DrawImage方法可以实现你的功能
public void DrawImage(
   Image image,
   Rectangle destRect,//目标大小
   int srcX,//源的x坐标
   int srcY,//源的y坐标
   int srcWidth,//源的宽度
   int srcHeight,//源的高度
   GraphicsUnit srcUnit,
   ImageAttributes imageAttr
);To 所以我想用api,Bitblt()
声明如下:
using System.Runtime.InteropServices;//BitBlt API declarition
[DllImport("gdi32.dll")] 
public static extern bool BitBlt( 
IntPtr hdcDest, // handle to destination DC 
int nXDest, // x-coord of destination upper-left corner 
int nYDest, // y-coord of destination upper-left corner 
int nWidth, // width of destination rectangle 
int nHeight, // height of destination rectangle 
IntPtr hdcSrc, // handle to source DC 
int nXSrc, // x-coordinate of source upper-left corner 
int nYSrc, // y-coordinate of source upper-left corner 
Int32 dwRop // raster operation code 
); 

解决方案 »

  1.   

    问一个问题,怎样把graphics和bitmap关联起来,使得drawimage时,不会画到屏幕上而是画到我要的bitmap上?
      

  2.   

    部分的图像复制;
    你看看这段代码是不是可以解决你的问题。 不用 api 以
    Bitmap myBit=new Bitmap(@"E:\Tools\photo\Photo\mummy1.jpg");
    int nXPos=200;//Position in picture
    int nYPos=200;Bitmap myBit2=new Bitmap(100, 100); //your size
    Graphics g=Graphics.FromImage(myBit2);
    g.DrawImage(myBit,new Rectangle(0,0,100,100)/*Dest rectangle*/,
    new Rectangle(nXPos,nYPos,100,100)/*Sour rectangle*/,
             GraphicsUnit.Pixel);this.BackgroundImage=myBit2;//Using new image
      

  3.   

    以前   Knight94(愚翁)  给我写的代码 :)