Nevron .NET Vision Documentation

Each view has two rulers - horizontal and vertical, which are represented by instances of the NHorizontalRuler and NVerticalRuler classes respectively. They both derive from the base NRuler class (on its turn derived from NViewComponent).

You can obtain a reference to the horizontal ruler via the HorizontalRuler property. Analogously a reference to the vertical ruler is obtained from the VerticalRuler property:

Copy Code
// get the horizontal and the vertical ruler
NHorizontalRuler hruler = view.HorizontalRuler;
NVerticalRuler vruler = view.VerticalRuler;
Visual Basic
Copy Code
' get the horizontal and the vertical ruler
Dim hruler As NHorizontalRuler = view.HorizontalRuler
Dim vruler As NVerticalRuler = view.VerticalRuler
Ruler Appearance
Rulers are displayed as framed rectangles on the top and left sides of the view window. The frame border color is controlled by the FrameColor property, while the ruler filling is controlled by the BackColor property. The size of each ruler can only be controlled in the dimension opposite to the ruler expand direction via the Size property (e.g. for the horizontal ruler the size is it's height). The offset of the view window from the ruler rim is called ruler padding and is controlled by the Padding property.
Ruler Ticks

Rulers display major and minor ticks. There is a fixed number of minor ticks displayed between two major ones, which is controlled by the MinorTicksCount property. The value from which the major ticks originate is called origin and is controlled by the Origin property and is specified in the ruler unit of measure.

The step of the major ticks can be determined in several modes. The major ticks step mode is controlled by the MajorTicksStepMode property, which can accept one of the following values:

Ruler Texts

Ruler texts are displayed for the values of the major ticks. Ruler texts are displayed with the font specified by the TextFontStyle property and with format defined by the TextFormat property. The text color is analogously controlled by the TextColor property. The following code alters the texts font, color and format:

Copy Code
// alter the ruler text font, color and format
ruler.TextFontStyle = new NFontStyle("Tahoma", 10);
ruler.TextColor = Color.Red;
ruler.TextFormat = "0.##";
Visual Basic
Copy Code
' alter the ruler text font, color and format
ruler.TextFontStyle = New NFontStyle("Tahoma", 10)
ruler.TextColor = Color.Red
ruler.TextFormat = "0.##"
Related Examples
Windows Forms: Drawing View - Rulers
See Also



©2019. Nevron Software LLC.

Send Feedback