Back to Devexpress

TextInfoControlBase.CustomizeText Event

windowsforms-devexpress-dot-xtrascheduler-dot-reporting-dot-textinfocontrolbase-2da698cf.md

latest4.7 KB
Original Source

TextInfoControlBase.CustomizeText Event

Occurs before the control is rendered, and enables you to modify the text being printed.

Namespace : DevExpress.XtraScheduler.Reporting

Assembly : DevExpress.XtraScheduler.v25.2.Reporting.dll

NuGet Package : DevExpress.Win.SchedulerReporting

Declaration

csharp
public event TextCustomizingEventHandler CustomizeText
vb
Public Event CustomizeText As TextCustomizingEventHandler

Event Data

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

PropertyDescription
TextGets or sets the text printed by the control.

Remarks

The CustomizeText event, in addition to the XRControl.BeforePrint event (which is inherited from the XtraReport control) provides the ability to modify the control’s content before it is printed. Event arguments for different controls are inherited from the TextCustomizingEventArgs base class, to implement properties specific to a particular control.

The following code sample handles the TextInfoControlBase.CustomizeText event for the TimeIntervalInfo control, to print the weekday name in French in the second text line of the control.

csharp
using DevExpress.XtraScheduler;
using DevExpress.XtraReports.UI;
using DevExpress.XtraScheduler.Reporting;
// ...
private void timeIntervalInfo1_CustomizeText(object sender, 
DevExpress.XtraScheduler.Reporting.TextCustomizingEventArgs e) {
    TimeIntervalTextCustomizingEventArgs args = (TimeIntervalTextCustomizingEventArgs)e;
    args.SecondLineText = args.Interval.Start.ToString("dddd",
        System.Globalization.CultureInfo.CreateSpecificCulture("fr-FR"));
}
vb
Imports DevExpress.XtraScheduler
Imports DevExpress.XtraReports.UI
Imports DevExpress.XtraScheduler.Reporting
' ...
Private Sub timeIntervalInfo1_CustomizeText(ByVal sender As Object, _
    ByVal e As DevExpress.XtraScheduler.Reporting.TextCustomizingEventArgs)

    Dim args As TimeIntervalTextCustomizingEventArgs = _
        CType(e, TimeIntervalTextCustomizingEventArgs)
    args.SecondLineText = args.Interval.Start.ToString("dddd", _
        System.Globalization.CultureInfo.CreateSpecificCulture("fr-FR"))
End Sub

The following code snippet handles the TextInfoControlBase.CustomizeText event of the ResourceInfo control, to print the resource captions with their IDs.

csharp
using DevExpress.XtraScheduler;
using DevExpress.XtraReports.UI;
using DevExpress.XtraScheduler.Reporting;
// ...
private void resourceInfo1_CustomizeText(object sender, TextCustomizingEventArgs e) {
    ResourceTextCustomizingEventArgs args = (ResourceTextCustomizingEventArgs)e;
    string text = "";
    foreach(Resource res in args.Resources)
        text = text + res.Caption + " (id = " + res.Id + ") ";
    args.Text = text;
}
vb
Imports DevExpress.XtraScheduler
Imports DevExpress.XtraReports.UI
Imports DevExpress.XtraScheduler.Reporting
' ...
Private Sub resourceInfo1_CustomizeText(ByVal sender As Object, ByVal e As TextCustomizingEventArgs)
    Dim args As ResourceTextCustomizingEventArgs = CType(e, ResourceTextCustomizingEventArgs)
    Dim text As String = ""
    For Each res As Resource In args.Resources
        text = text & res.Caption & " (id = " & res.Id & ") "
    Next res
    args.Text = text
End Sub

See Also

XRControl.BeforePrint

XRCrossBandControl.BeforePrint

TextInfoControlBase Class

TextInfoControlBase Members

DevExpress.XtraScheduler.Reporting Namespace