Articles in this section
Category / Section

How do I add a Diagram to a form?

4 mins read

 

Using the designer:

First, make sure you have added both the Syncfusion.Shared (namespace: Syncfusion.Windows.Forms) and Syncfusion.Diagram (namespace: Syncfusion.Windows.Forms.Diagram) controls to your toolbox. You do this by right-clicking on your toolbox and selecting all the components in these namespaces that you find listed under .NET Framework Components.

Once you have the Diagram components in your tool box, drag-and-drop the Diagram component onto your form. The model, view, and controller objects are available as properties under the MVC category in the Properties window.

From code:

[C#]

using Syncfusion.Drawing;

using Syncfusion.Windows.Forms.Diagram;  

 ....    private Syncfusion.Windows.Forms.Diagram.Controls.Diagram diagram1;  

 ....    // minimal code to create a diagram on a form

 this.diagram1 = new Syncfusion.Windows.Forms.Diagram.Controls.Diagram();

// add the Diagram control to the Form's control list

this.Controls.Add(this.diagram1);

 

[VB.NET]

Imports Syncfusion.Drawing

Imports Syncfusion.Windows.Forms.Diagram

 ....   Private diagram1 As Syncfusion.Windows.Forms.Diagram.Controls.Diagram  

 ....   ' minimal code to create a diagram on a form

 Me.diagram1 = New Syncfusion.Windows.Forms.Diagram.Controls.Diagram()

  'add the Diagram control to the Form's control list

Me.Controls.Add(Me.diagram1)

 

Conclusion

I hope you enjoyed learning about how to add a Diagram to a form.

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 forumsDirect-Trac, or feedback portal. We are always happy to assist you!

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