Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Afficher une image dans un Form

Afficher,une,image,dans,un,Form
{filelink=14621}

  using System;
  using System.Drawing;
  using System.Drawing.Drawing2D;
  using System.Collections;
  using System.ComponentModel;
  using System.Windows.Forms;
  using System.Data;
  using System.Drawing.Imaging;
 
  public class AffichageImage : System.Windows.Forms.Form
  {
    public AffichageImage()
    {
      InitializeComponent();
    }
    private void InitializeComponent()
    {
      this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
      this.ClientSize = new System.Drawing.Size(292, 273);
      this.Text = "Image dans un Form";
      this.Resize += new System.EventHandler(this.AffichageImage_Resize);
      this.Paint += new System.Windows.Forms.PaintEventHandler(this.AffichageImage_Paint);
 
    }
    private void AffichageImage_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
    {
      Graphics g = e.Graphics;
      String urlImage=@"C:Documents and SettingsAdministrateurMes documentshalf.png";
      Bitmap bmp = new Bitmap(urlImage);
 
      Rectangle r = new Rectangle(0, 0, bmp.Width, bmp.Height);
      g.DrawImage(bmp, this.ClientRectangle);
    }
 
    private void AffichageImage_Resize(object sender, System.EventArgs e)
    {
      Invalidate();
    }
     /* static void Main()
    {
      Application.Run(new AffichageImage());
    }*/
  }

No comments yet.

Leave a Comment