using
System.Drawing;
using
System.Drawing.Imaging;
class
AWindow : System.Windows.Forms.Form
{
private void OnPaint(object sender,
System.Windows.Forms.PaintEventArgs e)
{
System.Drawing.Graphics g = e.Graphics;
Bitmap TestImage = null;
TestImage = new
Bitmap("gremlin.jpg");
int iImageWidth =
TestImage.Width;
int iImageHeight =
TestImage.Height;
Rectangle destR = new
Rectangle(10, 10, TestImage.Width, TestImage.Height);
Rectangle srcR = new
Rectangle(0,0, TestImage.Width, TestImage.Height);
g.DrawImage(TestImage, destR, srcR, GraphicsUnit.Pixel);
// Or
Point p = new Point(10,10);
g.DrawImage(TestImage, p);
}//
End of OnPaint(..)
AWindow()
{
this.Paint +=
new System.Windows.Forms.PaintEventHandler(this.OnPaint);
}//
End of AWindow()
// Application Entry Point
static void
Main()
{
System.Windows.Forms.Application.Run(new
AWindow());
}//
End
Main()
}//
End of AWindow class |