ContextChangeEventArgs الواجهة
Provides بيانات for theSelect,Deselect,ContextEnterوContextLeaveأحداث of anXMLNodeكائن و theContextEnter,ContextLeave,Select, وDeselectأحداث of anXMLNodesكائن.
مساحة الاسم: Microsoft.Office.Tools.Word
التجميع: Microsoft.Office.Tools.Word (في Microsoft.Office.Tools.Word.dll)
بناء الجملة
'إقرار
<GuidAttribute("7403c9da-5555-41ed-8288-bf92e780d660")> _
Public Interface ContextChangeEventArgs
[GuidAttribute("7403c9da-5555-41ed-8288-bf92e780d660")]
public interface ContextChangeEventArgs
أمثلة
يوضح المثال التالي تعليمات برمجية حدث معالجات XMLNode.Select، XMLNode.Deselect، XMLNode.ContextEnter، و XMLNode.ContextLeaveحدث s. عند XMLNode.Selectو XMLNode.Deselectالأحداث مرفوع، قم بإضافة خطوط مزدوجة إلى حدود تحديد معالجات أحداث أو إزالة خطوط مزدوجة، اعتماداً على حدث. عندما يتم مرفوع في XMLNode.ContextEnterو XMLNode.ContextLeaveحدث s، حدث معالجات عرض الرسائل التي تقوم بتحديد أسماء العقد الجديد المحدد والعقدة المحددة سابقا. يفترض هذا المثال الذي مستند الحالي يحتوي على XMLNodeباسم 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 + "'.");
}