Resize particular node alone in the selection list
Resize particular node alone in the selection list
Diagram allows you to resize a particular child in the selection list. This can be achieved through the Diagram Model’s EventSink.SizeChanging event. This event is triggered while changing the size of the node.
The code snippet below is used for resizing a particular node in the selection list.
[C#]
// Registering the SizeChanging event
Diagram.Model.EventSink.SizeChanging += EventSink_SizeChanging;
Private Sub EventSink_SizeChanging(ByVal evtArgs As SizeChangingEventArgs);
if (Diagram.View.SelectionList.Count > 1 && evtArgs.NodeAffected is Node && !(evtArgs.NodeAffected is PseudoGroup))
{
if (Diagram.View.SelectionList.IndexOf(evtArgs.NodeAffected as Node) == 0)
{
Node node = evtArgs.NodeAffected as Node;
evtArgs.Cancel = false;
NodeCollection collection = new NodeCollection();
for (var i = 0; i < Diagram.View.SelectionList.Count; i++)
{
Microsoft.VisualBasic.Collection.Add(Diagram.View.SelectionList(i));
}
Diagram.View.SelectionList.Clear();
for (var i = 0; i < Microsoft.VisualBasic.Collection.Count; i++)
{
Diagram.View.SelectionList.Add(collection(i));
}
}
else
{
evtArgs.Cancel = true;
}
}
}
[VB]
'Registering the SizeChanging event Diagram.Model.EventSink.SizeChanging += EventSink_SizeChanging Private Sub EventSink_SizeChanging(ByVal evtArgs As SizeChangingEventArgs) If Diagram.View.SelectionList.Count > 1 AndAlso TypeOf evtArgs.NodeAffected Is Node AndAlso Not(TypeOf evtArgs.NodeAffected Is PseudoGroup) Then If Diagram.View.SelectionList.IndexOf(TryCast(evtArgs.NodeAffected, Node)) = 0 Then Dim node As Node = TryCast(evtArgs.NodeAffected, Node) evtArgs.Cancel = False Dim collection As New NodeCollection() For i = 0 To Diagram.View.SelectionList.Count - 1 Microsoft.VisualBasic.Collection.Add(Diagram.View.SelectionList(i)) Next i Diagram.View.SelectionList.Clear() For i = 0 To Microsoft.VisualBasic.Collection.Count - 1 Diagram.View.SelectionList.Add(collection(i)) Next i Else evtArgs.Cancel = True End If End If }
Conclusion
I hope you enjoyed learning about resizing a particular node alone in the selection list.
You can refer to WinForms Diagram feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms Diagram example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!