private String EndCapToString(Pen pen) { if (pen.EndCap != LineCap.Custom) { return(""); } ArrowStyle style = Hacks.GetLineCap(pen.CustomEndCap); switch (style) { case ArrowStyle.TinyArrow: case ArrowStyle.BigArrow: case ArrowStyle.LittleArrow: case ArrowStyle.LineArrow: case ArrowStyle.HollowArrow: case ArrowStyle.PointyArrow: arrowId++; defs.Add(String.Format("<marker id=\"arrow{1}\" viewBox=\"0 0 10 10\" refX=\"0\" refY=\"5\" stroke-width=\"1\" fill=\"rgb({0})\" orient=\"auto\">\n", ColorToRgb(pen.Color), arrowId) + "<path d=\"M 0 0 L 10 5 L 0 10 L 0 0\" />\n" + "</marker>"); break; case ArrowStyle.None: default: return(""); } return(String.Format(" marker-end=\"url(#arrow{0})\"", arrowId)); }
static LineDialog() { colors = Hacks.GetColorBrushes(); Array aarrows = Enum.GetValues(typeof(ArrowStyle)); arrows = aarrows as ArrowStyle[]; if (arrows == null) { throw new Exception("Unusual arrow styles"); } Array ashapes = Enum.GetValues(typeof(DecorationShape)); shapes = ashapes as DecorationShape[]; if (shapes == null) { throw new Exception("Got something unexpected from DecorationShape"); } dashstyles = new DashStyle[] { DashStyle.Solid, DashStyle.Dot, DashStyle.Dash, DashStyle.DashDot, DashStyle.DashDotDot }; widths = new int[10]; for (int i = 0; i < widths.Length; i++) { widths[i] = i + 1; } }
private static Pen GetArrowStyleSample(Color color, ArrowStyle ars) { Pen pen = new Pen(color, 2); if (ars == ArrowStyle.None) { pen.EndCap = LineCap.Flat; } else { pen.CustomEndCap = Hacks.GetLineCap(ars); } return(pen); }
private static CustomLineCap ArrowStyleToLineCap(ArrowStyle arrowstyle) { return(Hacks.GetLineCap(arrowstyle)); }