C# 利用GDI+画终点为箭头的直线

Pen p = new Pen(Color.Black, 5);
            Graphics g = this.panelControl2.CreateGraphics(); //this.CreateGraphics();
            //DrawArrow(g, p, 50, 20, 100, 20);
            p.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;//恢复实线
            p.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;//定义线尾的样式为箭头
            g.DrawLine(p, 10, 30, 200, 30);
            p.Dispose();
            g.Dispose();

你可能感兴趣的:(C#)