bandeee
bandeee

Reputation: 81

Drawing lines with an arrow in the middle

First of all sorry for my English... I would like to draw lines with arrows in the middle in c#. How can i do it?

I have done this:

Graphics g = e.Graphics;
g.SmoothingMode = SmoothingMode.AntiAlias;

Pen p = new Pen(Color.Black, 2);
p.StartCap = LineCap.Round;
p.EndCap = LineCap.ArrowAnchor;
g.DrawLine(p, StartX, StartY, EndX, EndY);
p.Dispose();

But it's not enough... I would like to draw the arrow to the line's middle...

Upvotes: 3

Views: 4176

Answers (1)

COLD TOLD
COLD TOLD

Reputation: 13579

try this maybe it helps

  AdjustableArrowCap bigArrow = new AdjustableArrowCap(5, 5);
   Pen p = new Pen(Color.Blue, 1);
   p.CustomEndCap = bigArrow;
   e.Graphics.DrawLine(p, 20, 20, 100, 100);

Upvotes: 1

Related Questions