-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathForm1.vb
67 lines (56 loc) · 2.74 KB
/
Form1.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
55
56
57
58
59
60
61
62
63
64
65
66
67
Imports System
Imports System.Drawing
Imports DevExpress.XtraBars.Docking.Paint
Imports DevExpress.Utils
Imports DevExpress.Skins
Imports DevExpress.LookAndFeel
Imports DevExpress.XtraEditors
Namespace WindowsFormsApplication1
Public Partial Class Form1
Inherits XtraForm
Public Sub New()
InitializeComponent()
barAndDockingController1.PaintStyles.Add(New MyPaintStyle(barAndDockingController1.PaintStyles))
barAndDockingController1.PaintStyleName = "MyScheme"
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
AddHandler myDockManager1.CustomDrawPanelCaption, New CustomDrawEventHandler(AddressOf myDockManager1_CustomDrawPanelCaption)
End Sub
Private Sub myDockManager1_CustomDrawPanelCaption(ByVal sender As Object, ByVal e As MyCustomDrawArgs)
If Not checkEdit1.Checked Then Return
Dim args As DrawWindowCaptionArgs = TryCast(e.Args, DrawWindowCaptionArgs)
If args IsNot Nothing Then
Dim appearance As AppearanceObject = New AppearanceObject()
appearance.BackColor = If(e.Panel Is myDockPanel1, Color.Yellow, Color.LightCyan)
appearance.BackColor2 = If(e.Panel Is myDockPanel1, Color.Orange, Color.SkyBlue)
appearance.GradientMode = Drawing2D.LinearGradientMode.Vertical
Dim rect As Rectangle = args.Bounds
rect.Inflate(-1, -1)
appearance.FillRectangle(args.Cache, rect)
End If
Dim appArgs As DrawApplicationCaptionArgs = TryCast(e.Args, DrawApplicationCaptionArgs)
If appArgs IsNot Nothing AndAlso args Is Nothing Then
Dim appearance As AppearanceObject = New AppearanceObject()
appearance.BackColor = Color.LightCyan
appearance.BackColor2 = Color.LightGreen
appearance.GradientMode = Drawing2D.LinearGradientMode.Horizontal
Dim rect As Rectangle = appArgs.Bounds
rect.Inflate(-1, -1)
appearance.FillRectangle(appArgs.Cache, rect)
End If
End Sub
Private i As Integer = 0
Public Sub SwitchSkin()
i += 1
If i > SkinManager.Default.Skins.Count - 1 Then i = 0
UserLookAndFeel.Default.SkinName = SkinManager.Default.Skins(i).SkinName
End Sub
Private Sub simpleButton1_Click(ByVal sender As Object, ByVal e As EventArgs)
SwitchSkin()
End Sub
Private Sub checkEdit1_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
myDockManager1.BeginUpdate()
myDockManager1.EndUpdate()
End Sub
End Class
End Namespace