Déssiner une Flèche

Author:

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

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

  public class UneFleche : System.Windows.Forms.Form
  {
    public UneFleche()
    {
      InitializeComponent();
    }
    private void InitializeComponent()
    {
        this.SuspendLayout();
        //
        // UneFleche
        //
        this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
        this.ClientSize = new System.Drawing.Size(150, 90);
        this.Name = "UneFleche";
        this.Text = "Exemple de ArrowAnchor";
        this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
        this.Resize += new System.EventHandler(this.Form1_Resize);
        this.ResumeLayout(false);

    }

    private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
    {
      Graphics g = e.Graphics;
      g.SmoothingMode = SmoothingMode.AntiAlias;
      g.FillRectangle(Brushes.White, this.ClientRectangle);

      Pen stylo = new Pen(Color.Blue, 10);
      stylo.StartCap = LineCap.Round;
      stylo.EndCap = LineCap.ArrowAnchor;
      g.DrawLine(stylo, 60, 60, 90, 30);
      stylo.Dispose();
    }

    private void Form1_Resize(object sender, System.EventArgs e)
    {
      Invalidate();
    }
    static void Main()
    {
      Application.Run(new UneFleche());
    }
  }

Leave a Reply

Your email address will not be published. Required fields are marked *