ContextChangeEventArgs Class (2007 System)
Provides data for the Select, Deselect, ContextEnter and ContextLeave events of the XMLNode class and the ContextEnter, ContextLeave, Select, and Deselect events of the XMLNodes class.
This API is not CLS-compliant.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)
Syntax
'Declaration
<CLSCompliantAttribute(False)> _
<PermissionSetAttribute(SecurityAction.Demand, Name := "FullTrust")> _
Public Class ContextChangeEventArgs _
Inherits EventArgs
'Usage
Dim instance As ContextChangeEventArgs
[CLSCompliantAttribute(false)]
[PermissionSetAttribute(SecurityAction.Demand, Name = "FullTrust")]
public class ContextChangeEventArgs : EventArgs
[CLSCompliantAttribute(false)]
[PermissionSetAttribute(SecurityAction::Demand, Name = L"FullTrust")]
public ref class ContextChangeEventArgs : public EventArgs
public class ContextChangeEventArgs extends EventArgs
Examples
The following code example demonstrates event handlers for the XMLNode.Select, XMLNode.Deselect, XMLNode.ContextEnter, and XMLNode.ContextLeave events. When the XMLNode.Select and XMLNode.Deselect events are raised, the event handlers add double lines to the borders of the selection or remove the double lines, depending on the event. When the XMLNode.ContextEnter and XMLNode.ContextLeave events are raised, the event handlers display messages that state the names of the newly selected node and the previously selected node. This example assumes that the current document contains an XMLNode named CustomerNode.
Private Sub CustomerNode_Select(ByVal sender As Object, _
ByVal e As Microsoft.Office.Tools.Word.ContextChangeEventArgs) _
Handles CustomerNode.Select
e.Selection.Borders.OutsideLineStyle = _
Word.WdLineStyle.wdLineStyleDouble
End Sub
Private Sub CustomerNode_Deselect(ByVal sender As Object, _
ByVal e As Microsoft.Office.Tools.Word.ContextChangeEventArgs) _
Handles CustomerNode.Deselect
e.Selection.Borders.OutsideLineStyle = _
Word.WdLineStyle.wdLineStyleNone
End Sub
Private Sub CustomerNode_ContextEnter(ByVal sender As Object, _
ByVal e As Microsoft.Office.Tools.Word.ContextChangeEventArgs) _
Handles CustomerNode.ContextEnter
MsgBox("You entered the node '" & e.NewXMLNode.BaseName & "'.")
End Sub
Private Sub CustomerNode_ContextLeave(ByVal sender As Object, _
ByVal e As Microsoft.Office.Tools.Word.ContextChangeEventArgs) _
Handles CustomerNode.ContextLeave
MsgBox("You left the node '" & e.OldXMLNode.BaseName & "'.")
End Sub
private void XMLNodeSelections()
{
this.CustomerNode.ContextEnter +=
new Microsoft.Office.Tools.Word.ContextChangeEventHandler(
CustomerNode_ContextEnter);
this.CustomerNode.ContextLeave +=
new Microsoft.Office.Tools.Word.ContextChangeEventHandler(
CustomerNode_ContextLeave);
this.CustomerNode.Select +=
new Microsoft.Office.Tools.Word.ContextChangeEventHandler(
CustomerNode_Select);
this.CustomerNode.Deselect +=
new Microsoft.Office.Tools.Word.ContextChangeEventHandler(
CustomerNode_Deselect);
}
void CustomerNode_Select(object sender,
Microsoft.Office.Tools.Word.ContextChangeEventArgs e)
{
e.Selection.Borders.OutsideLineStyle =
Word.WdLineStyle.wdLineStyleDouble;
}
void CustomerNode_Deselect(object sender,
Microsoft.Office.Tools.Word.ContextChangeEventArgs e)
{
e.Selection.Borders.OutsideLineStyle =
Word.WdLineStyle.wdLineStyleNone;
}
void CustomerNode_ContextEnter(object sender,
Microsoft.Office.Tools.Word.ContextChangeEventArgs e)
{
MessageBox.Show("You entered the node '" +
e.NewXMLNode.BaseName + "'.");
}
void CustomerNode_ContextLeave(object sender,
Microsoft.Office.Tools.Word.ContextChangeEventArgs e)
{
MessageBox.Show("You left the node '" +
e.OldXMLNode.BaseName + "'.");
}
Inheritance Hierarchy
System.Object
System.EventArgs
Microsoft.Office.Tools.Word.ContextChangeEventArgs
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.