Nevron .NET Vision Documentation
Stroke Style

The stroke style defines the visual appearance of object edges. It is represented by an instance of the NStrokeStyle class. The following sections discuss how to work with the different properties and methods of this class.


The Color property controls the color of the line. The following example changes the color of a the stroke:

Copy Code
someObject.StrokeStyle.Color = Color.Blue;
Visual Basic
Copy Code
someObject.StrokeStyle.Color = Color.Blue
Pattern and Factor

The Pattern property defines the pattern of the stroke style. It accepts a value from the LinePattern enumeration. The following table shows bars rendered with different pattern styles:

Solid Dot Dash DashDot DashDotDot

The Pattern and Factor properties define the line by working together to define whether a certain pixel from the line should be drawn or not. The values of the LinePattern enumeration actually represent 16-bit integers whose bit pattern determines which fragments of a line will be drawn when the line is rasterized. Bit zero is used first. For example the value of SolidLine is all ones (0xFFFF). You can create you own patterns by simply setting the bits of the short integer value that you want the line to draw. Suppose for example that you want to draw a line having three empty pixels, then one black then three empty and so forth. The value you should pass to the LinePattern in this case is 0x8888 or in binary 1000100010001000. You must also set the Factor property to 1. For example:

Copy Code
someObject.StrokeStyle.Color = System.Drawing.Color.Black;
someObject.StrokeStyle.Pattern = (LinePattern)0x8888;
someObject.StrokeStyle.Factor = 1;
Visual Basic
Copy Code
someObject.StrokeStyle.Color = System.Drawing.Color.Black
someObject.StrokeStyle.Pattern = CType(0x8888, LinePattern)
someObject.StrokeStyle.Factor = 1

The following formula shows how the Pattern and Factorproperties collaborate:

DrawPixel = ((2 ^ (DistanceFromLineStart / Factor)) % 16) & Pattern

This is illustrated visually by the following table, which shows several lines with dot pattern 0101010101010101 (in binary code) and a different line factor.

Factor Line with pattern 0101010101010101

The Width property controls the line width. As with all lengths in the Nevron Graphics it is specified by an instance of the NLength structure. The following code sets the stroke width to two points:

Copy Code
someObject.StrokeStyle.Width = new NLength(2, NGraphicsUnit.Point);
Visual Basic
Copy Code
someObject.StrokeStyle.Width = New NLength(2, NGraphicsUnit.Point)
See Also



©2019. Nevron Software LLC.

Send Feedback