C#的箭头画法
时间:2011-05-07 来源:孤独的猫
可以用Pen(画笔)的StartCap和EndCap定义箭头的起止形状,再用DrawLine画出
1 private void Form1_Paint(object sender, PaintEventArgs e)
2 {
3 Graphics g = e.Graphics;
4 g.SmoothingMode = SmoothingMode.AntiAlias;
5 g.FillRectangle(Brushes.White, this.ClientRectangle);
6
7 Pen p = new Pen(Color.Black, 10);
8 p.StartCap = LineCap.Round;
9 p.EndCap = LineCap.ArrowAnchor;
10 g.DrawLine(p, 30, 30, 80, 30);
11 p.Dispose();
12 }
相关阅读 更多 +