Search
Ruler Class
Remarks See Also
 





The Ruler control provides horizontal and vertical scales that help users measure diagram items.

Namespace: MindFusion.Diagramming.WinForms
Assembly: MindFusion.Diagramming.WinForms.Controls

 Syntax

C#  Copy Code

public class Ruler : Control

Visual Basic  Copy Code

Public Class Ruler
    Inherits Control

 Remarks

To use the Ruler control, you must customize the Visual Studio toolbox and add a reference to MindFusion.Diagramming.WinForms.Ruler.dll (unless you opted to install the control in the toolbox during installation). To specify which DiagramView instance is shown in the ruler, set the DiagramView property. After adding a DiagramView or a Ruler to a form, you might need to close and reopen that form, in order to have the DiagramView property drop-down list refreshed and populated with all DiagramView objects on the form.

The ruler tracks mouse movements and modifications being performed on an item, and displays markers over the scales indicating the current position in diagram's coordinate system. The colors of these markers can be changed using the PointerColor and ProjectionColor properties.

If EnableGuides is set to true, the ruler allows aligning several items by clicking on a scale and dragging. That displays alignment guides which follow the mouse pointer and move all selected items on their way. If no diagram elements are selected, all items are moved.

To specify the ruler unit, assign an instance of the MeasureUnit class to the Unit property. You can either use one of the predefined values (Millimeter, Inch, Pixel, and so on) or create a custom MeasureUnit. In order to specify different divisions for an existing unit, create a custom unit using the appropriate constructor. The following example illustrates how to change the divisions of the Inch unit form 8 (which is the default for inch) to 10:

C#  Copy Code

MeasureUnit custom = new MeasureUnit("Inch10", MeasureUnit.Inch, 1, 10);

Visual Basic  Copy Code

Dim custom As New MeasureUnit("Inch10", MeasureUnit.Inch, 1, 10)

 Inheritance Hierarchy

System.Object
    System.MarshalByRefObject
        System.ComponentModel.Component
            System.Windows.Forms.Control
                MindFusion.Diagramming.WinForms.Ruler

 See Also