Articles in this section
Category / Section

Resize particular node alone in the selection list

1 min read

Resize particular node alone in the selection list

Diagram allows you to resize a particular children in the selection list. It can be achieved through Diagram Model’s EventSink.SizeChanging event. This event is triggered while changing the size of the node.

The below code snippet 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
}

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied