Apples to: Nevron Diagram for .NET
How to ask a user for confirmation when he or she deletes a diagram shape?
To ask the user for confirmation when he or she deletes a shape from the diagram, you should do the following things:
[C#]
// Subscribe to the OnNodeRemoving event of the NDrawingDocument:
nDrawingDocument1.EventSinkService.NodeRemoving +=
new
ChildNodeCancelEventHandler(EventSinkService_NodeRemoving);
// Place the needed code in the event handler:
void
EventSinkService_NodeRemoving(NChildNodeCancelEventArgs args)
{
if
(MessageBox.Show(
"Remove ?"
,
"Question"
, MessageBoxButtons.YesNo, MessageBoxIcon.Question) !=
DialogResult.Yes)
{
args.Cancel =
true
;
}
}
[VB.NET]
' Subscribe to the OnNodeRemoving event of the NDrawingDocument:
AddHandler
NDrawingDocument1.EventSinkService.NodeRemoving,
AddressOf
EventSinkService_NodeRemoving
' Place the needed code in the event handler:
Private
Sub
EventSinkService_NodeRemoving(args
As
NChildNodeCancelEventArgs)
If
MessageBox.Show(
"Remove ?"
,
"Question"
, MessageBoxButtons.YesNo, MessageBoxIcon.Question) <> DialogResult.Yes
Then
args.Cancel =
True
End
If
End
Sub
Article ID: 15, Created On: 9/29/2010, Modified: 5/5/2011