3

首先对不起我的英语......我想在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();

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

4

1 回答 1

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);
于 2012-11-07T22:00:11.693 回答