共用方式為


DocumentBase.Windows Property

Definition

Gets a Windows collection that represents all windows for the document (for example, Sales.doc:1 and Sales.doc:2).

public:
 property Microsoft::Office::Interop::Word::Windows ^ Windows { Microsoft::Office::Interop::Word::Windows ^ get(); };
public Microsoft.Office.Interop.Word.Windows Windows { get; }
member this.Windows : Microsoft.Office.Interop.Word.Windows
Public ReadOnly Property Windows As Windows

Property Value

A Windows collection that represents all windows for the document.

Examples

The following code example creates two new windows for the document, and then uses the Windows property to tile all of the document windows from the top left of the screen. To use this example, run it from the ThisDocument class in a document-level project.

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

Applies to