BarItemType enumeration

Item type to change a bar style for.

public enum BarItemType


Task0Indicates Task bar item type.
Summary1Indicates Summary bar item type.
ProjectSummary2Indicates Project summary bar item type.
ManualTask3Indicates Manual task bar item type.
InactiveTask4Indicates Inactive task bar item type.
CriticalTask5Indicates Critical task bar item type.
Milestone6Indicates Milestone task bar item type.
ManualSummary7Indicates Manual summary bar item type.
Split8Indicates Split bar item type.
ExternalTasks9Indicates External tasks bar item type.
ExternalMilestone10Indicates External milestone bar item type.
Deadline11Indicates Deadline bar item type.
Progress12Indicates Progress bar item type.
StartOnly13Indicates Start-only bar item type.
FinishOnly14Indicates Finish-only bar item type.
DurationOnly15Indicates Duration-only bar item type.
InactiveMilestone16Indicates Inactive milestone bar item type.
InactiveSummary17Indicates Inactive summary bar item type.
SummaryRollup18Summary rollup bar item type.


Shows how to customize task bars by using <see cref=“Aspose.Tasks.Visualization.BarStyle” />s.

var project = new Project();

var task1 = project.RootTask.Children.Add("Task 1");
var task2 = project.RootTask.Children.Add("Task 2");

task1.Set(Tsk.Duration, project.GetDuration(1, TimeUnitType.Day));
task2.Set(Tsk.Duration, project.GetDuration(1, TimeUnitType.Day));

project.TaskLinks.Add(task1, task2, TaskLinkType.FinishToStart);

var task3 = project.RootTask.Children.Add("Task 3");
var rsc1 = project.Resources.Add("Resource 1");
var rsc2 = project.Resources.Add("Resource 2");
var rsc3 = project.Resources.Add("Resource 3");

project.ResourceAssignments.Add(task1, rsc1);
project.ResourceAssignments.Add(task2, rsc2);
project.ResourceAssignments.Add(task3, rsc3);

SaveOptions options = new PdfSaveOptions
    Timescale = Timescale.ThirdsOfMonths

var style = new BarStyle
                    ItemType = BarItemType.CriticalTask,
                    LeftBarTextConverter = delegate(Task t)
                        return string.Format("This task (ID = {0}) is on critical path", t.Get(Tsk.Id));

var style2 = new BarStyle { BarColor = Color.DarkOrchid, ItemType = BarItemType.Task };

options.BarStyles = new List<BarStyle> { style, style2 };

project.Save(OutDir + "CustomizeTextWithTaskBars_out.pdf", options);

See Also