/
XtraReport1.vb
54 lines (48 loc) · 1.43 KB
/
XtraReport1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Imports Microsoft.VisualBasic
#Region "#Usings"
Imports System.Drawing
Imports System.Drawing.Printing
Imports DevExpress.XtraPrinting
Imports DevExpress.XtraReports.UI
' ...
#End Region ' #Usings
Namespace ResetControlStyle
Partial Public Class XtraReport1
Inherits DevExpress.XtraReports.UI.XtraReport
Public Sub New()
InitializeComponent()
End Sub
#Region "#Code"
Private Sub xrLabel2_BeforePrint(ByVal sender As Object, _
ByVal e As PrintEventArgs) Handles xrLabel2.BeforePrint
SetCustomStyle(CType(sender, XRLabel))
End Sub
Private Sub xrLabel3_BeforePrint(ByVal sender As Object, _
ByVal e As PrintEventArgs) 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
#End Region ' #Code
End Class
End Namespace