Applies to: Nevron Diagram for .NET
How to show the shape directly in "InPlaceEdit" mode?
After dragging and dropping a shape from a library you can show the shape directly in "InPlaceEdit" mode, so that the user can directly edit the text of the Shape.
You can do this programmatically:
- Subscribe for the NodeInserted event of the document event sink service.
- When a shape is inserted in the diagram you can start its inplace editing.
- The following code will help you get started with your implementation:
[C#]
public
void
StartInplaceEdit(NShape shape)
{
// create edit control
Control control = shape.CreateInplaceEditControl(NPointF.Empty);
if
((control
is
INInplaceEditControl) ==
false
)
return
;
control.Hide();
// add the control in the view and transform it
nDrawingView1.Controls.Add(control);
(control
as
INInplaceEditControl).Transform(nDrawingView1.m_DocumentWorldToDevice);
// the view must be notified when the control is destroyed
control.HandleDestroyed +=
new
EventHandler(nDrawingView1.OnControlHandleDestroyed);
// show it
control.Show();
control.Focus();
}
[VB.NET]
Public
Sub
StartInplaceEdit(shape
As
NShape)
' create edit control
Dim
control
As
Control = shape.CreateInplaceEditControl(NPointF.Empty)
If
(
TypeOf
control
Is
INInplaceEditControl) =
False
Then
Return
End
If
control.Hide()
' add the control in the view and transform it
nDrawingView1.Controls.Add(control)
TryCast(control, INInplaceEditControl).Transform(nDrawingView1.m_DocumentWorldToDevice)
' the view must be notified when the control is destroyed
control.HandleDestroyed +=
New
EventHandler(nDrawingView1.OnControlHandleDestroyed)
' show it
control.Show()
control.Focus()
End
Sub
Article ID: 16, Created On: 9/29/2010, Modified: 11/15/2010