DocumentBase.Windows 属性

定义

获取一个 Windows 集合,该集合表示文档的所有窗口(例如,Sales.doc:1 和 Sales.doc:2)。

public Microsoft.Office.Interop.Word.Windows Windows { get; }

属性值

Windows

一个 Windows 集合,表示文档的所有窗口。

示例

下面的代码示例将为文档创建两个新窗口,然后使用 Windows 属性从屏幕左上角平铺所有文档窗口。 若要使用此示例,请在 ThisDocument 文档级项目的类中运行它。

private void DocumentWindows()
{
    Word.Window window1 = this.Windows.Add(ref missing);
    Word.Window window2 = this.Windows.Add(ref missing);

    int top = 10;
    int left = 10;
    foreach (Word.Window window in this.Windows)
    {
        window.Top = top;
        window.Left = left;
        top += 10;
        left += 10;
    }
}
Private Sub DocumentWindows()
    Dim window1 As Word.Window = Me.Windows.Add()
    Dim window2 As Word.Window = Me.Windows.Add()

    Dim top As Integer = 10
    Dim left As Integer = 10
    Dim window As Word.Window
    For Each window In Me.Windows
        window.Top = top
        window.Left = left
        top += 10
        left += 10
    Next window
End Sub

适用于