XRControl.Font Property

Gets or sets the control's font.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.2.dll

Declaration

[SRCategory(ReportStringId.CatAppearance)]
public virtual Font Font { get; set; }
<SRCategory(ReportStringId.CatAppearance)>
Public Overridable Property Font As Font

Property Value

Type Description
Font

A Font object that represents font settings including font face, size, and style attributes.

The Font property specifies the font of the control's XRControl.Text, while the text alignment is specified by the XRControl.TextAlignment property.

If the Font property's value is not set for the current report control, its value is obtained from its parent, or a parent of its parent and so on. Similarly, the Font value of the current control is applied to all its child report controls (if there are any in its XRControl.Controls collection), if their Font property value is not set. For more information on this concept, please refer to Appearance Properties.

Note

The Font property is used only by some descendants of the XRControl class. For example, the XRPageBreak class ignores the Font property.

Examples

This example demonstrates how to create a hyperlink in a report. Note that such label behaves as a hyperlink both in a report's Print Preview and HTML, PDF, RTF, XLS and XLSX formats.

To add a hyperlink, to the Report Detail Band, handle the Report's XRControl.BeforePrint event in the following way.

using DevExpress.XtraReports.UI;
// ...

private void XtraReport1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
    // Create a new hyperlink and add it to the report's Detail Band.
    Bands.GetBandByType(typeof(DetailBand)).Controls.Add(CreateHyperlink());
}

The code below creates a hyperlink using the XRLabel object, and specifies its XRControl.NavigateUrl, XRControl.Target and other properties.

using System.Drawing;
using DevExpress.XtraReports.UI;
// ...

public XRLabel CreateHyperlink(){
    // Create a label for a hyperlink.
    XRLabel hyperlinkLabel = new XRLabel();

    // Set its main properties.
    hyperlinkLabel.Text = "DevExpress Inc.";
    hyperlinkLabel.Width = 200;
    hyperlinkLabel.ForeColor = Color.Blue;
    hyperlinkLabel.Font = new Font("Tahoma", 12, FontStyle.Underline);

    // Set its URL and target.
    hyperlinkLabel.NavigateUrl = "http://www.devexpress.com";
    hyperlinkLabel.Target = "_blank";

    return hyperlinkLabel;
}

See Also