在中间用箭头画线

时间:2012-11-07 21:56:14

标签: c#

首先抱歉我的英文... 我想在c#的中间用箭头画线。我该怎么办?

我做到了:

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();

但这还不够......我想把箭画到线的中间......

1 个答案:

答案 0 :(得分:1)

尝试这可能有帮助

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