| |||||||||||||
SharpPlot Tutorials General Tutorials Chart Samples Style Examples SharpLeaf Tutorials Document Layout Tutorials Text Flow Tutorials Table Tutorials Visual Glossaries SharpPlot Reference SharpPlot Class SharpPlot Properties SharpPlot Methods SharpPlot Structures SharpPlot Enumerations PageMap Class SharpLeaf Reference SharpLeaf Class SharpLeaf Properties SharpLeaf Methods Table Class Table Properties Table Methods SharpLeaf Structures FontType Structure ParagraphStyle Structure BoxStyle Structure SharpLeaf Enumerations DocumentLayout Classes DocumentLayout Class PageLayout Class PageElement Abstract Class Frame : PageElement Class TextBlock : PageElement Class ImageBlock : PageElement Class Box : PageElement Class Rule : PageElement Class Document Class VectorMath Class DbUtil Class Download Release Notes Licensing |
Common Reference > LineStyle Struct LineStyle StructLine-styles (built-in and user-defined dash-repeat sequences). public struct LineStyle Public ConstructorCreates a custom dashed line from a vector of even length giving on-off pattern, proportionally to the line width. public LineStyle( int[] dashPattern ); public LineStyle( double[] dashPattern ); Examplesp.SetContourStyle(Color.Red,LineStyle.Dash,1.2); sp.SetDatumLineStyle(Color.Maroon,new LineStyle(new int[] {12,4,24,4})); // Long dashes Public Static Properties
Creating Custom Dashed LinesA dashed line is defined by an array of numbers which give the on-off-on-off cycle. Dash lengths are always proportional the line width. Custom lines are drawn with square ends to make the segments exactly the length you ask for. The cycle always begins at the start of the pattern (so the dash-offset is zero) here. For example: LineStyle mydash = new LineStyle(new int[]{1,2,2,2,3,2,4,2}); Note that in charts rendered to SVG you can animate the dash-offset to give the effect of a ‘walking line’. Using a Pen object with Raster OutputIt is possible to use an existing .Net Pen object to create your line, but this method will only be effective in charts rendered to raster formats. public LineStyle( Pen myPen ); The color and Width of the pen will be overridden by the color setting and width of the line being drawn. RequirementsNamespace: Causeway Assembly: SharpPlot (in sharpplot.dll) See also ...BoxStyle Structure | SharpPlot.SetDatumLineStyle Method | SharpPlot.SetGridLineStyle Method | SharpPlot.SetLineStyles Method |