public static Pen GetPen(Dictionary <string, Pen> pens, Color color, float size, RPLFormat.BorderStyles style) { string key = GDIPen.GetKey(color, size, style); Pen pen = default(Pen); if (pens.TryGetValue(key, out pen)) { return(pen); } pen = new Pen(color, size); switch (style) { case RPLFormat.BorderStyles.Dashed: pen.DashStyle = DashStyle.Dash; break; case RPLFormat.BorderStyles.Dotted: pen.DashStyle = DashStyle.Dot; break; } pens.Add(key, pen); return(pen); }
public override void DrawRectangle(Color color, float size, RPLFormat.BorderStyles style, RectangleF rectangle) { this.m_graphics.DrawRectangle(GDIPen.GetPen(this.m_pens, color, (float)this.ConvertToPixels(size), style), rectangle); }
public override void DrawLine(Color color, float size, RPLFormat.BorderStyles style, float x1, float y1, float x2, float y2) { this.m_graphics.DrawLine(GDIPen.GetPen(this.m_pens, color, (float)this.ConvertToPixels(size), style), x1, y1, x2, y2); }