Partager via


Diagram.GridSize Property

Gets or sets the default grid size for the shapes on the diagram.

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

Syntax

'Déclaration
Public Overrides Property GridSize As Double
    Get
    Set
public override double GridSize { get; set; }
public:
virtual property double GridSize {
    double get () override;
    void set (double value) override;
}
abstract GridSize : float with get, set
override GridSize : float with get, set
override function get GridSize () : double
override function set GridSize (value : double)

Property Value

Type: System.Double
The size of the grid for the diagram.

Remarks

When a shape is moved by the user, it snaps to a grid – that is, its position is adjusted so that the X and Y coordinates are multiples of the grid size. For each shape, the relevant grid size is specified by its own GridSize property, and the default value is the GridSize of the parent. The grid size of a diagram determines the default GridSize for its children.

Set this value to change the grid size for the diagram and the default for its child shapes.

If you want to change the default grid size for all instances of a diagram type, override DefaultGridSize.

To switch off grid adjustment, set the GridSize to 0.0.

.NET Framework Security

See Also

Reference

Diagram Class

Microsoft.VisualStudio.Modeling.Diagrams Namespace

DefaultGridSize

GridSize