This document is archived and information here might be outdated. Recommended version. |
Helper coclass for working with the nondefault outbound IEditEvents2 interface in VB.
Interfaces | Description |
---|---|
IEditEvents2 | Provides access to more editor events. Implement it to listen for specific events that occur during an edit session. |
The following code shows how to wire edit events in C#.
public void WireEditEvents2()
{
UID editorUid = new UIDClass();
editorUid.Value = "esriEditor.Editor";
//You can get app from ICommand :: OnCreate() hook parameter
IEditor editor = app.FindExtensionByCLSID(editorUid) as IEditor;
((IEditEvents2_Event)editor).OnVertexAdded +=
new IEditEvents2_OnVertexAddedEventHandler(OnVertexAdded);
}
void OnVertexAdded(IPoint point)
{
System.Windows.Forms.MessageBox.Show("Vertex Added.");
}
The following code shows how to wire edit events in VBNet.
Public Sub WireEditEvents()
'You can get app from ICommand :: OnCreate() hook parameter
Dim editorUid As UID = New UIDClass()
editorUid.Value = "esriEditor.Editor"
Dim editor As IEditor = TryCast(app.FindExtensionByCLSID(editorUid), IEditor)
'Wire editor events.
AddHandler (CType(editor, IEditEvents2_Event).OnVertexAdded), AddressOf OnVertexAdded
End Sub
Private Sub OnVertexAdded(ByVal point As IPoint)
System.Windows.Forms.MessageBox.Show("Vertex Added.")
End Sub