Skip to main content
All docs
V25.1
  • GanttControl.CustomDrawTimelineTask Event

    Allows you to draw tasks displayed on the timeline.

    Namespace: DevExpress.XtraGantt

    Assembly: DevExpress.XtraGantt.v25.1.dll

    NuGet Package: DevExpress.Win.Gantt

    Declaration

    [DXCategory("Events")]
    public event GanttTimelineCustomDrawItemEventHandler CustomDrawTimelineTask

    Event Data

    The CustomDrawTimelineTask event's data class is CustomDrawTimelineTaskEventArgs. The following properties provide information specific to this event:

    Property Description
    Appearance Gets the appearance settings of a task.
    Cache Provides access to the drawing surface and a cache of brushes, pens, fonts, and other graphics. Inherited from CustomDrawEventArgs.
    Handled Gets or sets whether the event is handled and allows you to prevent the control from drawing the visual element in its default appearance. Inherited from CustomDrawEventArgs.
    Node Gets the node that corresponds to the task displayed on the timeline.
    Task Gets view information about the task displayed on the timeline.
    TaskType

    The event data class exposes the following methods:

    Method Description
    DefaultDraw() Draws the task in its default appearance.
    DrawHtml(HtmlTemplate, DxHtmlPainterContext, Action<DxHtmlPainterArgs>) Draws the specified HTML template inside the task displayed on the timeline. The context parameter allows you to assign an object that transfers mouse events to template elements.
    DrawHtml(HtmlTemplate, Action<DxHtmlPainterArgs>) Draws the specified HTML template inside the task displayed on the timeline.

    Remarks

    The following example demonstrates how to highlight summary tasks displayed on the timeline:

    ganttControl1.CustomDrawTimelineTask += GanttControl1_CustomDrawTimelineTask;
    
    private void GanttControl1_CustomDrawTimelineTask(object sender, CustomDrawTimelineTaskEventArgs e) {
        if(e.Task.Type == DevExpress.XtraGantt.Scheduling.GanttControlTaskType.SummaryTask)
            e.Appearance.BackColor = DXSkinColors.FillColors.Success;
    }
    

    The image below shows the result:

    Custom Draw Timeline Task - WinForms Gantt Control

    See Also