XRControl.ResetBorderWidth() Method
Resets the XRControl.BorderWidth property value, so that it is no longer stored in the current control and is obtained from its parent instead.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v22.2.dll
NuGet Package: DevExpress.Reporting.Core
Declaration
Remarks
If the XRControl.BorderWidth 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. So, if it is set in the current control, it starts overriding its parent’s BorderWidth property value.
Then, if it is necessary to remove the current control’s BorderWidth property value and start using its parent’s BorderWidth again, you can right-click the Properties window at design time and choose the Reset option, as shown in the image below.
And the ResetBorderWidth method is intended to do the same action at runtime.
Example
This example demonstrates how to assign custom appearance settings (e.g., XRControl.BackColor, XRControl.ForeColor, XRControl.Borders, XRControl.Font, etc.) to report elements and reset them to their default values, as well as how to make a control ignore its personal appearance settings in favor of the settings of its parent control.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/Reporting_how-to-use-the-appearance-settings-of-report-elements-e933.
Imports System.Drawing
Imports System.Drawing.Printing
Imports DevExpress.XtraPrinting
Imports DevExpress.XtraReports.UI
' ...
Private Sub xrLabel2_BeforePrint(ByVal sender As Object, _
ByVal e As CancelEventArgs) Handles xrLabel2.BeforePrint
SetCustomStyle(CType(sender, XRLabel))
End Sub
Private Sub xrLabel3_BeforePrint(ByVal sender As Object, _
ByVal e As CancelEventArgs) Handles xrLabel3.BeforePrint
SetCustomStyle(CType(sender, XRLabel))
ResetStyle(CType(sender, XRLabel))
End Sub
' Assign custom appearance settings to a control.
Private Sub SetCustomStyle(ByVal label As XRLabel)
label.BackColor = Color.Gray
label.BorderColor = Color.DarkGray
label.Borders = BorderSide.All
label.BorderWidth = 0.5f
label.Font = New Font(label.Parent.Font, FontStyle.Bold)
label.ForeColor = Color.White
label.TextAlignment = TextAlignment.MiddleRight
End Sub
' Restore the appearance settings to their default values.
Private Sub ResetStyle(ByVal label As XRLabel)
label.ResetBackColor()
label.ResetBorderColor()
label.ResetBorders()
label.ResetBorderWidth()
label.ResetFont()
label.ResetForeColor()
label.ResetPadding()
label.ResetTextAlignment()
End Sub