Mega Code Archive

 
Categories / C# / 2D Graphics
 

DrawImage with destination points

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; public class Form1 : Form {     protected override void OnPaint(PaintEventArgs e) {     Graphics g = e.Graphics;     Bitmap bmp = new Bitmap("rama.jpg");     g.FillRectangle(Brushes.White, this.ClientRectangle);     Point[] destinationPoints = {       new Point(0, 0),    // destination for upper-left point of original       new Point(100, 0),  // destination for upper-right point of original       new Point(50, 100)};// destination for lower-left point of original     g.DrawImage(bmp, destinationPoints);     }     public static void Main() {         Application.Run(new Form1());     } }