Guides in Windows Forms Diagram

27 Apr 20211 minute to read

Guides for the Diagram control are viewable, non printing guidelines used to align a diagram node with other nodes. They provide support to align a diagram node with the boundary, center, or margin of other nodes.

You can also change the visual style of Guides by using its LineStyle property.

Properties

The following table describes the various properties associated with Diagram Guides.

Guides Properties

Property Name Description
Guides Gets the Diagram Guides.
Enable Specifies whether to turn on/off Diagram Guides.
LineStyle Gets or sets the visual style for Diagram Guides.
Type Specifies the Guide Type for nodes. The options included are as follows:

Boundary

Center

Margin

All

Margin Gets or sets the margin between nodes.

The following code example illustrates how to turn on Guides for Diagram Nodes while dragging or resizing nodes.

// Turns on Guides in Diagram.
diagram1.Controller.Guides.Enable = true;

// Shows All Types of Guides.
diagram1.Controller.Guides.Type = GuideTypes.All;

// Specifies Line Color for Guides.
diagram1.Controller.Guides.LineStyle.LineColor = Color.FromArgb(255, 153, 51);

// Sets the Margin between Nodes.
diagram1.Controller.Guides.Margin = 50;
'Turns on Guides in Diagram.
diagram1.Controller.Guides.Enable = True

'Shows All Types of Guides.
diagram1.Controller.Guides.Type = GuideTypes.All

'Specifies Line Color for Guides.
diagram1.Controller.Guides.LineStyle.LineColor = Color.FromArgb(255, 153, 51)

'Sets the Margin between Nodes.
diagram1.Controller.Guides.Margin = 50

Diagram Guides