Skip to main content
All docs
V25.1
  • GanttControlPrintAppearanceCollection.LegendItem Property

    Provides access to legend item appearance settings.

    Namespace: DevExpress.XtraGantt

    Assembly: DevExpress.XtraGantt.v25.1.dll

    NuGet Package: DevExpress.Win.Gantt

    Declaration

    public AppearanceObject LegendItem { get; }

    Property Value

    Type Description
    AppearanceObject

    An object that contains appearance settings.

    Remarks

    You can print the chart legend and additional information in page footers.

    Gantt Control Legend and Page Information

    Legend

    Enable the PrintLegend property to display a chart legend in page footers.

    The AppearancePrint property provides access to appearance settings used to print the control. You can use the following properties to specify how to print the legend:

    • Legend — appearance settings used to print the chart legend.
    • LegendItem — appearance settings used to print items in the chart legend.

    Ensure that the UsePrintStyles property is set to true (the default value) to enable these settings.

    Page Information

    Enable the PrintPageInfo property to display additional information in page footers. The default footer contains the current date, page number, and the total number of pages.

    Use the PageInfoType property to specify the type of information that should be displayed. The PageInfoFormat property allows you to apply a custom format to this information. Use the {0} and {1} placeholders to insert a specific portion of information into the format. The passed content depends on the type of information. For example, if PageInfoType is set to NumberOfTotal, {0} is replaced with the page number, and {1} is replaced with the total number of pages.

    You can also use the PageInfoCaption property to display a custom caption in the page footers.

    The AppearancePrint property provides access to the PageInfo and PageInfoCaption properties that specify appearance settings used to print page information.

    Example

    The code below shows how to display the chart legend and page information.

    Gantt Control Custom Legend

    using System.Drawing;
    using DevExpress.XtraPrinting;
    
    // Print the chart legend.
    ganttControl1.OptionsPrint.PrintLegend = DefaultBoolean.True;
    // Specify custom foreground and background colors for the chart legend.
    ganttControl1.AppearancePrint.Legend.BackColor = Color.FromArgb(224, 224, 224);
    ganttControl1.AppearancePrint.Legend.Options.UseBackColor = true;
    ganttControl1.AppearancePrint.LegendItem.ForeColor = Color.FromArgb(64, 0, 64);
    ganttControl1.AppearancePrint.LegendItem.Options.UseForeColor = true;
    // Print the Project's caption and Project Manager's name in the footer.
    ganttControl1.OptionsPrint.PrintPageInfo = DefaultBoolean.True;
    ganttControl1.OptionsPrint.PageInfoType = XtraPrinting.PageInfo.UserName;
    ganttControl1.OptionsPrint.PageInfoFormat = "Project Manager: {0}";
    ganttControl1.OptionsPrint.PageCaption = "Software Development";
    // Specify the footer background color.
    ganttControl1.AppearancePrint.PageInfo.BackColor = Color.FromArgb(255, 192, 128);
    ganttControl1.AppearancePrint.PageInfo.Options.UseBackColor = true;
    
    See Also