The Tickmark property on the WinGauge control is used to visually display the values on a scale of your Radial or Linear gauge.
The next step after adding tick marks to a scale on your gauge is to Add Labels to a Gauge.
You can add tick marks to your scale:
When you save and run your application after completing the following steps, your gauge should look similar to the gauge below.
To add tick marks to your scales using the Gauge Designer:
In the Gauge Explorer, expand Scale.
Select Major Tickmarks.
In the Extent pane of the Tickmark Layout tab of the Properties panel, set the following properties:
Start — 85
End — 95
In the Widths pane of the Tickmark Layout tab, set the following properties:
Start — 3
End — 3
In the Orientation pane of the Tickmark Layout tab, set the Frequency to 10.00\.
In the Gauge Explorer, select Minor Tickmarks
In the Extent pane of the Properties panel, set the following properties:
Start — 85
End — 90
In the Widths pane of the Tickmark Layout tab, set the following properties:
Start — 1
End — 1
In the Orientations pane of the Tickmark Layout tab, set the Frequency to 2.00.
To add tick marks to your scales at design time:
In the Gauges Collection editor window, click the Scales property. Then, click the ellipsis (…) button to open the Scales editor.
Expand the MajorTickmarks property. Then click the BrushElement property, and from the drop-down list, select Solid Fill.
Expand the BrushElement property and set the Color property to 189, 189, 189.
Under the MajorTickmarks property, set the following properties:
StartExtent — 75
StartWidth — 3
Frequency — 10
EndExtent — 85
EndWidth — 3
Expand the MinorTickmarks property. Then click the BrushElement property, and from the drop down list, select SolidFill.
Expand the BrushElement property. Then set the Color property to 240, 240, 240\.
Under the MinorTickmarks property, set the following properties:
StartExtent — 85
StartWidth — 1
Frequency — 2
EndExtent — 90
EndWidth — 1
To add tick marks to your scales at run time:
Add the following steps to the load event.
Create instances of the classes:
In Visual Basic:
Dim mySolidFillBrushElementMajor As New SolidFillBrushElement() Dim mySolidFillBrushElementMinor As New SolidFillBrushElement() Dim mySolidFillBrushElementMinorStroke As New SolidFillBrushElement() Dim myStrokeElement As New StrokeElement()
In C#:
SolidFillBrushElement mySolidFillBrushElementMajor = new SolidFillBrushElement(); SolidFillBrushElement mySolidFillBrushElementMinor = new SolidFillBrushElement(); SolidFillBrushElement mySolidFillBrushElementMinorStroke = new SolidFillBrushElement(); StrokeElement myStrokeElement = new StrokeElement();
Set the following MajorTickmarks properties:
Color — 189, 189, 189
StartExtent — 85
StartWidth — 3
Frequency — 10
EndExtent — 95
EndWidth — 3
In Visual Basic:
mySolidFillBrushElementMajor.Color = System.Drawing.Color.FromArgb( _ CInt(CByte(189)), _ CInt(CByte(189)), _ CInt(CByte(189))) myScale.MajorTickmarks.BrushElement = mySolidFillBrushElementMajor myScale.MajorTickmarks.EndExtent = 95 myScale.MajorTickmarks.EndWidth = 3 myScale.MajorTickmarks.Frequency = 10 myScale.MajorTickmarks.StartExtent = 85 myScale.MajorTickmarks.StartWidth = 3
In C#:
mySolidFillBrushElementMajor.Color = System.Drawing.Color.FromArgb( ((int)(((byte)(189)))), ((int)(((byte)(189)))), ((int)(((byte)(189))))); myScale.MajorTickmarks.BrushElement = mySolidFillBrushElementMajor; myScale.MajorTickmarks.EndExtent = 95; myScale.MajorTickmarks.EndWidth = 3; myScale.MajorTickmarks.Frequency = 10; myScale.MajorTickmarks.StartExtent = 85; myScale.MajorTickmarks.StartWidth = 3;
Set the following MinorTickmarks properties:
Color — 240, 240, 240
StartExtent — 85
StartWidth — 1
Frequency — 2
EndExtent — 90
EndWidth — 1
In Visual Basic:
mySolidFillBrushElementMinor.Color = System.Drawing.Color.FromArgb( _ CInt(CByte(240)), _ CInt(CByte(240)), _ CInt(CByte(240))) myScale.MinorTickmarks.BrushElement = mySolidFillBrushElementMinor myScale.MinorTickmarks.EndExtent = 90 myScale.MinorTickmarks.EndWidth = 1 myScale.MinorTickmarks.Frequency = 2 myScale.MinorTickmarks.StartExtent = 85 mySolidFillBrushElementMinorStroke.Color = System.Drawing.Color.FromArgb( _ CInt(CByte(135)), _ CInt(CByte(135)), _ CInt(CByte(135))) myStrokeElement.BrushElement = mySolidFillBrushElementMinorStroke myScale.MinorTickmarks.StrokeElement = myStrokeElement
In C#:
mySolidFillBrushElementMinor.Color = System.Drawing.Color.FromArgb( ((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); myScale.MinorTickmarks.BrushElement = mySolidFillBrushElementMinor; myScale.MinorTickmarks.EndExtent = 90; myScale.MinorTickmarks.EndWidth = 1; myScale.MinorTickmarks.Frequency = 2; myScale.MinorTickmarks.StartExtent = 85; mySolidFillBrushElementMinorStroke.Color = System.Drawing.Color.FromArgb( ((int)(((byte)(135)))), ((int)(((byte)(135)))), ((int)(((byte)(135))))); myStrokeElement.BrushElement = mySolidFillBrushElementMinorStroke; myScale.MinorTickmarks.StrokeElement = myStrokeElement;