C#绘制虚线

Pen pen = new Pen(Color.Red, 1);
            pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
            pen.DashPattern = new float[] { 5, 5 };
            Graphics gh = this.CreateGraphics();
            gh.DrawLine(pen, 10, 150, 500, 150);

你可能感兴趣的:(C#绘制虚线)