Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Dessiner des formes Géométriques

Modifier,le,mode,de,composition,d'une,image
{filelink=16680}

  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 FormeGeo : System.Windows.Forms.Form
  {
    public FormeGeo()
    {
      InitializeComponent();
    }
    private void InitializeComponent()
    {
      this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
      this.ClientSize = new System.Drawing.Size(292, 273);
      this.Text = "Les Formes Géométriques";
      this.Resize += new System.EventHandler(this.FormeGeo_Resize);
      this.Paint += new System.Windows.Forms.PaintEventHandler(this.FormeGeo_Paint);
 
    }
 
    private void FormeGeo_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
    {
      Graphics gForm = e.Graphics;
      gForm.FillRectangle(Brushes.White, this.ClientRectangle);
 
      Bitmap bmp = new Bitmap(260, 260, PixelFormat.Format32bppArgb);
      Graphics gBmp = Graphics.FromImage(bmp);
      gBmp.CompositingMode = CompositingMode.SourceCopy;
 
      Color rouge = Color.FromArgb(0x60, 0xff, 0, 0);
      Brush brosseRouge = new SolidBrush(rouge);
      gBmp.FillEllipse(brosseRouge, 70, 70, 160, 160);
 
      Color vert = Color.FromArgb(0x40, 0, 0xff, 0);
      Brush brosseVerte = new SolidBrush(vert);
      gBmp.FillRectangle(brosseVerte, 10, 10, 140, 140);
 
      gForm.DrawImage(bmp, 20, 20, bmp.Width, bmp.Height);
 
      bmp.Dispose();
      gBmp.Dispose();
      brosseRouge.Dispose();
      brosseVerte.Dispose();
 
    }
 
    private void FormeGeo_Resize(object sender, System.EventArgs e)
    {
      Invalidate();
    }
      static void Main()
    {
      Application.Run(new FormeGeo());
    }
  }

No comments yet.

Leave a Comment