Skip to main content
A newer version of this page is available. .

XRLine Class

A control that allows you to draw lines in reports.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v20.2.dll

NuGet Packages: DevExpress.Reporting.Core, DevExpress.WindowsDesktop.Reporting.Core

Declaration

public class XRLine :
    XRControl

Remarks

The XRLine control allows you to draw a line with a specific direction, style, width, and color. You can use the control to decorate and visually separate the report’s sections. See the following demo for an example of how to separate invoice data from the invoice’s summary results: Invoice.

Note

You can draw a line only within one band. To draw a line across multiple bands, use XRCrossBandLine. To draw borders for report controls, use the Borders property instead of the XRLine control.

Add a Line to a Report

Drag the XRLine item from the DX:20.2: Report Controls Toolbox tab and drop the item onto the report to add a line.

RD_Controls_Line

Customize Appearance

Click the line’s smart tag to access the main control properties:

report-control-line-0

  • Line Direction

    Enables you to draw a line horizontally, vertically, and diagonally (Horizontal, Vertical, Slant, Back Slant).

    report-control-line-1

  • Line Style

    You can select the solid, dashed, dotted, or mixed line style.

    report-control-line-2

  • Line Width

    Specifies the line width in pixels as a floating point value.

  • Anchor Vertically

    Specifies the vertical anchoring style for a line.

Create a Line in Code

This example creates the XRLine control in code and sets the control’s properties.

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

public XRLine CreateXRLine() {
   // Create a line.
   XRLine line = new XRLine();

   // Set a color.
   line.ForeColor = Color.Red;

   // Set width.
   line.LineWidth = 0.5F;

   // Set a style.
   line.LineStyle = DashStyle.DashDot;

   // Set a size.
   line.SizeF = new SizeF(300F, 100F);

   // Set a direction.
   line.LineDirection = LineDirection.BackSlant;

   return line;
}
See Also