1. Products
  2.   Diagram
  3.   .NET
  4.   GoDiagram
 
  

Free C# .NET Library for Interactive & Customizable Diagrams

A Powerful Open Source Free C# .NET Diagramming Library to Create & Manage Interactive Diagrams, Charts, and Graphs with ease.

When it comes to software development, making interactive and attractive diagrams can be tough. Whether you’re working on a flowchart, org chart, or any diagram-focused project, having a strong library to help is key. That’s where GoDiagram, a .NET library, steps in. GoDiagram is a robust tool for .NET developers that offers a wide range of features to make creating and customizing interactive diagrams easier for you in Windows Forms and WPF applications.

GoDiagram, a flexible .NET library, empowers software developers like you to craft engaging and personalized diagrams for various applications. Created by Northwoods Software, a renowned expert in diagram solutions, this library offers a wide array of features. It equips you with a robust toolkit to develop diagram applications effortlessly on Windows Forms and WPF platforms. Its goal is to simplify the development process, allowing you to easily make, modify, and handle diagrams, all while giving them a sleek and polished appearance.

With GoDiagram, you have the tools to create apps for various areas like business process design and network structure display. This resource provides a variety of diagram parts like nodes, links, and groups that you can adapt to suit your requirements. It also comes with layout algorithms that let you organize nodes and links in a visually appealing way without any hassle. If you’re tackling a project that requires creating diagrams for work, school, or any other area, GoDiagram can make your work easier and improve how people interact with your creations. Why not test it out, see what it can do, and tap into the potential of diagramming in your .NET projects?

Previous Next

Getting Started with GoDiagram

The recommend way to install GoDiagram is using NuGet. Please use the following command for a smooth installation.

Install GoDiagram via NuGet

Install-Package Northwoods.GoDiagram.WinForms -Version 10.0.6

Create a Simple Diagram via C# API

The open source GoDiagram library has included compete support for creating a new diagram from the scratch and manage its properties inside C# applications. It supports creating various types of diagrams, such as Flowchart, State Chart, Organizational Chart, Block Diagram, Pert Chart, Visual Tree, and many more. Here is an a simple example that demonstrates how software developers can create a basic diagram using C# .NET commands. It is also very easy to customize and extend the diagram as needed.

How to Generate a Basic Diagram with a Single Node inside C# Apps?

// Create a GoView control
GoView myView = new GoView();

// Add it to your Windows Forms or WPF application

// Create a node
GoBasicNode myNode = new GoBasicNode();
myNode.Text = "My Node";

// Add the node to the view
myView.Document.Add(myNode);	

Convert Diagram to Image via C# Library

The GoDiagram library gives software developers the power to convert an existing diagram to different types of image formats inside .NET applications. The library has provided two methods for creating images from diagrams, the first one generate Base64 image data string and the second method generate new image with the image data as its source. The following example shows how to convert an existing diagram to a PNG image format. You can easily customize the export format and file path as needed for your specific use case.

How to Convert a Diagram to Image Format using .NET Library?

using System;
namespace GoDiagramToImage
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
            InitializeGoDiagram();
        }

        private void InitializeGoDiagram()
        {
            // Create a GoView control and add it to the form
            GoView goView = new GoView();
            goView.Dock = DockStyle.Fill;
            Controls.Add(goView);

            // Load a sample diagram from a file (you can load your own diagram here)
            goView.Document.Clear();
            goView.Document.Add(new GoBasicNode() { Location = new PointF(100, 100), Text = "Sample Node 1" });
            goView.Document.Add(new GoBasicNode() { Location = new PointF(300, 100), Text = "Sample Node 2" });
            goView.Document.Add(new GoLink() { FromPort = goView.Document[0].BottomPort, ToPort = goView.Document[1].TopPort });

            // Optional: Perform an automatic layout to arrange the diagram nicely
            goView.Document.Layout = new GoLayoutForceDirected();
        }

        private void exportButton_Click(object sender, EventArgs e)
        {
            // Create a Bitmap to render the diagram
            Bitmap diagramImage = new Bitmap(goView.ClientSize.Width, goView.ClientSize.Height);
            Graphics graphics = Graphics.FromImage(diagramImage);

            // Render the diagram onto the Bitmap
            goView.DrawView(graphics);

            // Save the Bitmap as an image file (e.g., PNG)
            diagramImage.Save("Diagram.png", System.Drawing.Imaging.ImageFormat.Png);

            // Clean up resources
            graphics.Dispose();
            diagramImage.Dispose();
        }
    }
}	

Versatile Node/Link Types & Serialization Support

The GoDiagram library offers a variety of built-in node and link types, including simple shapes, text labels, and custom elements. You can easily create and customize these elements to represent data or concepts in your application. Whether you need to draw flowcharts, organizational charts, or any other type of diagram, the library has you covered. Moreover, the library also allows users to save and load diagrams to and from various formats, including XML, binary, and image files. This feature makes it easy to persist user-created diagrams and share them across different platforms.

 English