Freigeben über


Diagram.SnapToGrid Property

If true, shapes on the diagram are adjusted to align with a grid when they are moved by the user. Default value is true.

Namespace:  Microsoft.VisualStudio.Modeling.Diagrams
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.Diagrams.10.0.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public Property SnapToGrid As Boolean
    Get
    Set
[BrowsableAttribute(false)]
public bool SnapToGrid { get; set; }
[BrowsableAttribute(false)]
public:
property bool SnapToGrid {
    bool get ();
    void set (bool value);
}
[<BrowsableAttribute(false)>]
member SnapToGrid : bool with get, set
function get SnapToGrid () : boolean
function set SnapToGrid (value : boolean)

Property Value

Type: System.Boolean

Remarks

When snap-to-grid is turned on, shapes are automatically aligned as the user move them on the diagram. The X and Y values of the positions are set to multiples of their GridSize.

If you do not want any shapes in your diagram to be aligned to a grid, override this property to return false. If you want alignment only for some shapes, leave this property true, and override the GridSize to return 0.0 for those ShapeElements that you want to be unaligned.

.NET Framework Security

See Also

Reference

Diagram Class

Microsoft.VisualStudio.Modeling.Diagrams Namespace

GridSize

DefaultGridSize