Code to Draw a Arrow using Graphics

This is a simple code to draw a Arrow using Graphics Class.


//In Form's Paint Event

//e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
Graphics g = e.Graphics;
//Pen Class to draw Arrow;
//20 = size of arrow
Pen p = new Pen(Color.Red,20);
//ArrowAnchor = Point
p.StartCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
//Flat = Flat side
p.EndCap = System.Drawing.Drawing2D.LineCap.Flat;
//(p,x,y,x-coordinate,y-coordinate)
g.DrawLine(p,10,20,80,20);

For more Clearity just add
//e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: