共用方式為


DocumentBase.GridDistanceHorizontal Property

Gets or sets the amount of horizontal space between the invisible gridlines that Microsoft Office Word uses when you draw, move, and resize AutoShapes or East Asian characters in the document.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public Property GridDistanceHorizontal As Single
public float GridDistanceHorizontal { get; set; }

Property Value

Type: System.Single
The amount of horizontal space between the invisible gridlines that Microsoft Office Word uses when you draw, move, and resize AutoShapes or East Asian characters in the document.

Examples

The following code example sets the horizontal and vertical point of origin for the grid, sets the horizontal and vertical distance between gridlines, and then enables the Snap objects to grid feature for the document. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub DocumentGridDistanceHorizontal()
    Me.GridOriginHorizontal = 80
    Me.GridOriginVertical = 90
    Me.GridDistanceHorizontal = 9
    Me.GridDistanceVertical = 9
    Me.SnapToGrid = True 
    Me.Application.Options.DisplayGridLines = True 
End Sub
private void DocumentGridDistanceHorizontal()
{
    this.GridOriginHorizontal = 80;
    this.GridOriginVertical = 90;
    this.GridDistanceHorizontal = 9;
    this.GridDistanceVertical = 9;
    this.SnapToGrid = true;
    this.Application.Options.DisplayGridLines = true;
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace