Load bmp image from file : BMP « 2D « C# / CSharp Tutorial






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


  class Form1 : Form
  {
    private Image theImage;

    public Form1()
    {
      SetStyle(ControlStyles.Opaque, true);
      theImage = new Bitmap("person.bmp");
    }

    protected override void OnPaint(PaintEventArgs e)
    {
      Graphics g = e.Graphics;

      g.DrawImage(theImage, ClientRectangle);
    }
    [STAThread]
    static void Main()
    {
      Application.EnableVisualStyles();
      Application.Run(new Form1());
    }
  }








27.20.BMP
27.20.1.Draw BMP imagesDraw BMP images
27.20.2.Load bmp image from file