All docs
V20.1
20.2 (EAP/Beta)
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

GanttControl.CustomDrawTimescaleColumn Event

Fires before a column in the chart area is displayed. Provides access to a drawing surface and allows you to draw the column manually.

Namespace: DevExpress.XtraGantt

Assembly: DevExpress.XtraGantt.v20.1.dll

Declaration

[DXCategory("Events")]
public event CustomDrawTimescaleColumnEventHandler CustomDrawTimescaleColumn
<DXCategory("Events")>
Public Event CustomDrawTimescaleColumn As CustomDrawTimescaleColumnEventHandler

Event Data

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

Property Description
Column Gets the processed column.

Examples

The code below shows how to display a deadline in the chart.

DateTime deadLine = TaskStorage.GetFinishDateFromTask("Deploy Beta");
ganttControl.CustomDrawTimescaleColumn += (sender, e) => {
    GanttTimescaleColumn column = e.Column;
    if(column.StartDate <= deadLine && column.FinishDate >= deadLine) {
        e.DrawBackground();
        float x = (float)e.GetPosition(deadLine); float width = 4;
        RectangleF deadLineRect = new RectangleF(x, column.Bounds.Y, width, column.Bounds.Height);
        e.Cache.FillRectangle(DXSkinColors.FillColors.Danger, deadLineRect);
        e.DrawHeader();
        e.Handled = true;
    }
};

The code below shows how to draw striplines.

DateTime striplineStart = DateTime.Now.AddHours(5);
DateTime striplineEnd = striplineStart.AddHours(4);
Color striplineColor = Color.FromArgb(128, 255, 224, 166);
ganttControl.CustomDrawTimescaleColumn += (sender, e) => {
    GanttTimescaleColumn column = e.Column;
    float stripLineStartPoint = (float)Math.Max(e.GetPosition(striplineStart), column.Bounds.Left);
    float stripLineEndPoint = (float)Math.Min(e.GetPosition(striplineEnd), column.Bounds.Right);
    e.DrawBackground();
    RectangleF boundsToDraw = new RectangleF(stripLineStartPoint, column.Bounds.Y, stripLineEndPoint - stripLineStartPoint, column.Bounds.Height);
    if(boundsToDraw.Width > 0)
        e.Cache.FillRectangle(striplineColor, boundsToDraw);
    e.DrawHeader();
    e.Handled = true;
};
NOTE

Run the Gantt Code Examples demo to see the complete example.

See Also