C# 图片上画连线时 自定义两点间的划线段样式

Graphics g = this.pictureBox1.CreateGraphics();
Brush brush = new SolidBrush(Color.White);
Pen pen = new Pen(brush, 1);
//pen.DashStyle = DashStyle.Solid;//using System.Drawing.Drawing2D;
pen.DashPattern = new float[]{2,10};
pen.DashStyle = DashStyle.Custom;
g.DrawLine(pen,new Point(x1,y1),new Point(x2,y2));
g.Dispose();

你可能感兴趣的:(自定义)