illustrates using a graphics file : Graphics File « 2D Graphics « C# / C Sharp






illustrates using a graphics file

illustrates using a graphics file
/*
Mastering Visual C# .NET
by Jason Price, Mike Gunderloy

Publisher: Sybex;
ISBN: 0782129110
*/

/*
  Example21_5.cs illustrates using a graphics file
*/

using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

public class Example21_5 : System.Windows.Forms.Form
{
  private System.ComponentModel.Container components = null;

  public Example21_5()
  {
    InitializeComponent();
  }

  protected override void Dispose( bool disposing )
  {
    if( disposing )
    {
      if (components != null) 
      {
        components.Dispose();
      }
    }
    base.Dispose( disposing );
  }

  private void InitializeComponent()
  {
    this.BackColor = System.Drawing.Color.White;
    this.ClientSize = new System.Drawing.Size(400, 400);
    this.Name = "Example21_5";
    this.Text = "Example21_5";
    this.Paint += new System.Windows.Forms.
      PaintEventHandler(this.Example21_5_Paint);
  }


  static void Main() 
  {
    Application.Run(new Example21_5());
  }

  private void Example21_5_Paint(
    object sender, System.Windows.Forms.PaintEventArgs e)
  {
    Graphics g = e.Graphics;
    // Load the image
    Bitmap b = new Bitmap("CSharp.tif");
    // and display it
    g.DrawImage(b, 10, 10, 350, 300);
  }
}



           
       








Related examples in the same category