Improving the Performance of the Diagram while Selecting and Moving the lots of Nodes
Improving the Performance of the Diagram
While performing interactions in the diagram containing lots of nodes (for example: 100 Nodes and 100 Connectors), there will be a dispute in its performance. To overcome the dispute, we need to pause and resume some of the services that utilize maximum resources, which are the reason for the performance dispute.
We have listed the services that result in maximum resource utilization:
- LinkManager,
- HistoryManager,
- BridgeManager and
- EventSink.
LinkManager:
LinkManager holds the information about the connected Nodes in the diagram.
HistoryManager:
HistoryManager holds the history of the diagram, such as adding a node and deleting a node.
BridgeManager:
BridgeManager holds the information’s about bridging which is enabled when two connectors intersects each other.
EventSink:
EventSink holds information about the events which are registered in the control.
Pause the Service:
The below code snippet is used to pause the service.
[C#]
// Pause the services void m_diagram_MouseDown(object sender, MouseEventArgs e) { this.m_diagram.Model.LinkManager.Pause(); this.m_diagram.EventSink.Pause(); this.m_diagram.Model.EventSink.Pause(); this.m_diagram.Model.BridgeManager.Pause(); this.m_diagram.Model.HistoryManager.Pause(); }
[VB] Private Sub m_diagram_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Me.m_diagram.Model.LinkManager.Pause() Me.m_diagram.EventSink.Pause() Me.m_diagram.Model.EventSink.Pause() Me.m_diagram.Model.BridgeManager.Pause() Me.m_diagram.Model.HistoryManager.Pause() End Sub
Resuming the Service:
The below code snippet is used for resuming the service.
[C#] // Resuming the services void m_diagram_MouseUp(object sender, MouseEventArgs e) { this.m_diagram.Model.LinkManager.Resume(); this.m_diagram.Model.HistoryManager.Resume(); this.m_diagram.Model.BridgeManager.Resume(); this.m_diagram.Model.EventSink.Resume(); this.m_diagram.EventSink.Resume(); }
[VB] 'Resuming the services Private Sub m_diagram_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Me.m_diagram.Model.LinkManager.Resume() Me.m_diagram.Model.HistoryManager.Resume() Me.m_diagram.Model.BridgeManager.Resume() Me.m_diagram.Model.EventSink.Resume() Me.m_diagram.EventSink.Resume() End Sub
Conclusion
I hope you enjoyed learning about improving the performance of the diagram while selecting and moving lots of nodes.
You can refer to the 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!