Back to Devexpress

XRControl.Borders Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xrcontrol-a1c742da.md

latest10.8 KB
Original Source

XRControl.Borders Property

Specifies a set of borders (top, right, bottom, left) that should be visible for the control.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

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

Property Value

TypeDescription
BorderSide

A BorderSide enumeration value or combination of values, specifying a set of visible borders.

|

Available values:

NameDescription
None

No borders are applied to a brick.

| | Left |

Applies the left border to a brick.

| | Top |

Applies the top border to a brick.

| | Right |

Applies the right border to a brick.

| | Bottom |

Applies the bottom border to a brick.

| | All |

Applies all borders to a brick.

|

Remarks

The Borders property specifies which borders of the control should be visible, while the border color is specified by the XRControl.BorderColor property, and its width is specified by the XRControl.BorderWidth property. Note that if the XRControl.BorderWidth property is set to 0 , the control’s borders become invisible.

Appearance properties specified for bands or panels propagate to child controls, even though they may not take effect for some report elements. An obvious example of this behavior is the DetailBand element, that has no visible border or background color, even though it passes appearance property settings to its child controls. Another example is the XRPageBreak control, that has the XRControl.BackColor property, but ignores its value during rendering.

Review the following help topic for more information: Appearance Properties.

If a report element has a style assigned to it, the priority of the properties defined by that style is determined by the StylePriority property. Note that if conditional formatting is involved, the appearance it defines has a higher priority.

Note

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

Example

The following example demonstrates how to create an XRControl object and set some of its properties at runtime.

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

public XRControl CreateMyXRControl() {
    // Create a control.
    XRControl xrControl1 = new XRControl();

    // Set its background color.
    xrControl1.BackColor = Color.LightGray;

    // Set its border color.
    xrControl1.BorderColor = Color.Blue;

    // Make its left and right borders visible.
    xrControl1.Borders = DevExpress.XtraPrinting.BorderSide.Left |
        DevExpress.XtraPrinting.BorderSide.Right;

    // Set its border width (in pixels).
    xrControl1.BorderWidth = 10;

    // Set its location and size (in hundredths of an inch).
    xrControl1.LocationF = new PointF(200F, 100F);
    xrControl1.SizeF = new SizeF(300F, 150F);

    return xrControl1;
}
vb
Imports System.Drawing
Imports DevExpress.XtraReports.UI
' ...

Private Function CreateMyXRControl()
    ' Create a control.
    Dim xrControl1 As New XRControl()

    ' Set its background color.
    xrControl1.BackColor = Color.LightGray

    ' Set its border color.
    xrControl1.BorderColor = Color.Blue

    ' Make its left and right borders visible.
    xrControl1.Borders = DevExpress.XtraPrinting.BorderSide.Left Or _ 
        DevExpress.XtraPrinting.BorderSide.Right

    ' Set its border width (in pixels).
    xrControl1.BorderWidth = 10

    ' Set its location and size (in hundredths of an inch).
    xrControl1.Location = New Point(200, 100)
    xrControl1.SizeF = new SizeF(300F,150F)

    Return xrControl1
End Function

The following code snippets (auto-collected from DevExpress Examples) contain references to the Borders property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

reporting-winforms-create-report-dynamically-and-bind-it-to-dataset/CS/Form1.cs#L110

csharp
if (i > 0)
    label.Borders = BorderSide.Right | BorderSide.Top | BorderSide.Bottom;
else

winforms-create-a-custom-exporter-for-pivotgridcontrol-with-xtrareport/CS/Report_at_Runtime/PivotReportGenerator.cs#L191

csharp
if (isFirstColumnInTable) {
    headerCell.Borders = DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Top | DevExpress.XtraPrinting.BorderSide.Bottom;
    detailCell.Borders = DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Top | DevExpress.XtraPrinting.BorderSide.Bottom;

reporting-winforms-create-table-at-runtime/CS/TableReport.cs#L23

csharp
XRTable table = new XRTable();
table.Borders = DevExpress.XtraPrinting.BorderSide.All;
table.BeginInit();

reporting-winforms-appearance-settings/CS/XtraReport1.cs#L43

csharp
label.BorderColor = Color.DarkGray;
label.Borders = BorderSide.All;
label.BorderWidth = 0.5f;

reporting-winforms-label-report-in-code/CS/Reporting_how-to-create-a-label-report-at-runtime-t473792/LabelReportRuntime/CustomLabelReportBuilder.cs#L56

csharp
panel.HeightF = labelHeight;
panel.Borders = BorderSide.All;
detail.HeightF = XRConvert.Convert(model.VerticalPitch, labelDpi, report.Dpi);

reporting-winforms-create-report-dynamically-and-bind-it-to-dataset/VB/Form1.vb#L104

vb
If i > 0 Then
    label.Borders = BorderSide.Right Or BorderSide.Top Or BorderSide.Bottom
Else

winforms-create-a-custom-exporter-for-pivotgridcontrol-with-xtrareport/VB/Report_at_Runtime/PivotReportGenerator.vb#L194

vb
If isFirstColumnInTable Then
    headerCell.Borders = DevExpress.XtraPrinting.BorderSide.Left Or DevExpress.XtraPrinting.BorderSide.Top Or DevExpress.XtraPrinting.BorderSide.Bottom
    detailCell.Borders = DevExpress.XtraPrinting.BorderSide.Left Or DevExpress.XtraPrinting.BorderSide.Top Or DevExpress.XtraPrinting.BorderSide.Bottom

reporting-winforms-create-table-at-runtime/VB/TableReport.vb#L24

vb
Dim table As New XRTable()
table.Borders = DevExpress.XtraPrinting.BorderSide.All
table.BeginInit()

reporting-winforms-appearance-settings/VB/XtraReport1.vb#L32

vb
label.BorderColor = Color.DarkGray
label.Borders = BorderSide.All
label.BorderWidth = 0.5F

reporting-winforms-label-report-in-code/VB/Reporting_how-to-create-a-label-report-at-runtime-t473792/LabelReportRuntime/CustomLabelReportBuilder.vb#L56

vb
panel.HeightF = labelHeight
panel.Borders = BorderSide.All
detail.HeightF = XRConvert.Convert(model.VerticalPitch, labelDpi, report.Dpi)

See Also

Appearance Properties

Report Visual Styles

Conditionally Change the Control's Appearance

XRControl Class

XRControl Members

DevExpress.XtraReports.UI Namespace