Document.WindowSize, événement

Se produit lorsque la fenêtre de document est redimensionnée ou déplacée.

Espace de noms :  Microsoft.Office.Tools.Word
Assembly :  Microsoft.Office.Tools.Word (dans Microsoft.Office.Tools.Word.dll)

Syntaxe

'Déclaration
Event WindowSize As WindowEventHandler
event WindowEventHandler WindowSize

Exemples

L'exemple de code suivant crée un gestionnaire pour l'événement WindowSize. Le gestionnaire d'événements affiche, dans le titre de la fenêtre, le nombre de fois que la fenêtre a été redimensionnée. Cet exemple est pour un complément d'application.

Private resizeCount As Integer = 0
Private Sub DocumentWindowSize()
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    AddHandler vstoDoc.WindowSize, AddressOf ThisDocument_WindowSize
End Sub

Private Sub ThisDocument_WindowSize(ByVal sender As Object, ByVal e As Microsoft.Office.Tools.Word.WindowEventArgs)
    resizeCount += 1
    e.Window.Caption = "Window resized " & resizeCount.ToString() & " times."
End Sub
int resizeCount = 0;
private void DocumentWindowSize()
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.WindowSize +=
        new Microsoft.Office.Tools.Word.WindowEventHandler(
        ThisDocument_WindowSize);
}

void ThisDocument_WindowSize(object sender,
    Microsoft.Office.Tools.Word.WindowEventArgs e)
{
    resizeCount++;
    e.Window.Caption = "Window resized " +
        resizeCount.ToString() + " times.";
}

Sécurité .NET Framework

Voir aussi

Référence

Document Interface

Microsoft.Office.Tools.Word, espace de noms