Winforms Gantt Chart

Released 5 years ago , Last update 5 years ago

This .NET 4.0 class library project provides a C# Winforms UserControl that draws a gantt chart using GDI+

Winforms Gantt Chart Control

This winforms control is specifically useful if you are looking to quickly generate a gantt chart from raw data or draw the chart area of a typical gantt chart application.

The code is organised into a Chart usercontrol (view layer) and a ProjectManager (data layer) with a customisable (by inheritance) Task object which you can attach custom business data to suit your application.

screen shot demo of control in action

Control Features

  • Features Time unit independant data structure specification
  • Single tasks, grouped tasks, precedent/dependant tasks, split tasks, tagged resources
  • Printing respects page margin, orientation and multiple pages per page
  • Percentage complete property for each task
  • Various mouse events for customising UI experience directly on the chart.
  • Comes with default mouse commands that can be overriden through inheritance.
  • Determines critical path and slack
4.0
  • 5 0
  • 4 1
  • 3 0
  • 2 0
  • 1 0
1 Reviews Read Reviews

Pricing

14 day 14-day money-back guarantee

FREE

MIT license

The MIT license is an open-source license.

$24.99

Application License

  • Perpetual license

  • unlimited applications

  • Can distribute binary products only

  • Commercial use

$32.99

Developer License

  • Perpetual license

  • Unlimited projects

  • Can distribute code and binary products

  • Commercial use

Documentation

Sample usage is written below for easy reference. For full control documentation, please refer to doxygen documentation. Sample project is also included in the package.

Basic Usage: Create Chart and Adding Tasks

public Form1()
{
    InitializeComponents();
    var manager = new ProjectManager();
    var task = new Task() { Name = "Hello World" };
    manager.Add(task);
    var chart = new Chart();
    chart.Init(manager);

    this.Controls.Add(chart);
}

Common Task Manipulation

You can manipulate the task through code using various methods in the ProjectManager:

// Set task durations 
_mManager.SetDuration(wake, 3);
// Give the Tasks some organisation, setting group and precedents e.g. make "wake" task a subtask under "work"
_mManager.Group(work, wake);
// Setting task dependencies e.g. make "wake" task a precedent of "brush teeth" task
_mManager.Relate(wake, teeth);
// Assigning Resources e.g. add "jake" resource to "wake" task
_mManager.Assign(wake, jake);
// splitting a tasks e.g. split the "pack up" task into 2 new tasks
_mManager.Split(pack, new MyTask(_mManager), new MyTask(_mManager), 2);
// set some tooltips to show the resources in each task e.g. set a tooltip on the "wake" task
_mChart.SetToolTip(wake, string.Join(", ", _mManager.ResourcesOf(wake).Select(x => (x as MyResource).Name)));

Custom Task Data: Different colors for every tasks

You can change the default task appearance for all task, or as in here change individual task color as a demo for adding customer business data to tasks.

public partial class ExampleSimple : Form
{
    ProjectManager _mProject;

    public ExampleSimple()
    {
        InitializeComponent();

        _mProject = new ProjectManager();
        _mProject.Add(new Task() { Name = "New Task" });
        _mProject.Add(new ColoredTask() { Name = "Purple Task", Color = Color.Purple });
        _mProject.Add(new ColoredTask() { Name = "Gold Task", Color = Color.Gold });
        _mChart.Init(_mProject);

        // Custom behavior on paint task
        _mChart.PaintTask += (s, e) =>
        {
            ColoredTask ctask = e.Task as ColoredTask;
            if (ctask != null)
            {
                var format = new TaskFormat();
                format = e.Format;
                format.BackFill = new SolidBrush(ctask.Color);
                e.Format = format;
            }
        };

        // Grab custom data for tasks
        _mChart.TaskSelected += (s, e) =>
        {
            ColoredTask ctask = e.Task as ColoredTask;
            if (ctask != null)
            {
                MessageBox.Show("Selected " + ctask.Color.ToString());
            }
        };
    }
}

// Custom task with business data
public class ColoredTask : Task
{
    public ColoredTask()
        : base()
    {
    }

    public Color Color { get; set; }
}

Installation

This package is provided as a Microsoft Visual Studio 2010 .NET 4.0 C# solution with source code, example project and unit test project and comes with a copy of doxygen HTML documentation.

There is no special requirement or third party binaries required for compilation.

4 licenses, starting from From » FREE View Licenses

Get A Quote

What do you need?
  • Custom development
  • Integration
  • Customization / Reskinning
  • Consultation
When do you need it?
  • Soon
  • Next week
  • Next month
  • Anytime

Thanks for getting in touch!

Your quote details have been received and we'll get back to you soon.


Or enter your name and Email
No comments have been posted yet.