Back to Devexpress

GanttControl.CustomDrawTimelineTask Event

windowsforms-devexpress-dot-xtragantt-dot-ganttcontrol-b4592cd4.md

latest4.5 KB
Original Source

GanttControl.CustomDrawTimelineTask Event

Allows you to draw tasks displayed on the timeline.

Namespace : DevExpress.XtraGantt

Assembly : DevExpress.XtraGantt.v25.2.dll

NuGet Package : DevExpress.Win.Gantt

Declaration

csharp
[DXCategory("Events")]
public event GanttTimelineCustomDrawItemEventHandler CustomDrawTimelineTask
vb
<DXCategory("Events")>
Public Event CustomDrawTimelineTask As GanttTimelineCustomDrawItemEventHandler

Event Data

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

PropertyDescription
AppearanceGets the appearance settings of a task.
CacheProvides access to the drawing surface and a cache of brushes, pens, fonts, and other graphics. Inherited from CustomDrawEventArgs.
HandledGets 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.
NodeGets the node that corresponds to the task displayed on the timeline.
TaskGets view information about the task displayed on the timeline.
TaskType

The event data class exposes the following methods:

MethodDescription
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:

csharp
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;
}
vb
Private ganttControl1.CustomDrawTimelineTask += AddressOf GanttControl1_CustomDrawTimelineTask

Private Sub GanttControl1_CustomDrawTimelineTask(ByVal sender As Object, ByVal e As CustomDrawTimelineTaskEventArgs)
    If e.Task.Type = DevExpress.XtraGantt.Scheduling.GanttControlTaskType.SummaryTask Then
        e.Appearance.BackColor = DXSkinColors.FillColors.Success
    End If
End Sub

The image below shows the result:

See Also

CustomDrawTimelineBar

GanttControl Class

GanttControl Members

DevExpress.XtraGantt Namespace