copy one bitmap into another with stretching - CSharp System.Drawing

CSharp examples for System.Drawing:Bitmap

Description

copy one bitmap into another with stretching

Demo Code


using System.Drawing.Imaging;
using System.Drawing;
using System.Collections;
using System;//from  w ww.  ja  va2  s  . c  om

public class Main{
      /// <summary>
      /// Just a simpler way to copy one bitmap into another with stretching. Too many parameters in the standard DrawImage method...
      /// </summary>
      /// <param name="dst"></param>
      /// <param name="src"></param>
      public static void DrawImage(Image dst, Image src)
      {
         Graphics g = Graphics.FromImage(dst);
         g.DrawImage(src, new Rectangle(0,0,dst.Width,dst.Height), new Rectangle(0,0,src.Width,src.Height), GraphicsUnit.Pixel);
      }
}

Related Tutorials