-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.vb
67 lines (62 loc) · 2.64 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.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports DevExpress.XtraEditors
Imports DevExpress.Utils.Drawing
Imports DevExpress.Utils
Imports DevExpress.XtraBars
Imports System.Drawing.Drawing2D
Namespace DXSample
Partial Public Class Main
Inherits XtraForm
Public Sub New()
InitializeComponent()
End Sub
Private Sub RibbonControl1_CustomDrawItem(ByVal sender As Object, ByVal e As DevExpress.XtraBars.BarItemCustomDrawEventArgs) Handles ribbonControl1.CustomDrawItem
If e.RibbonItemInfo Is Nothing Then
Return
End If
Dim link = TryCast(e.RibbonItemInfo.Item, BarItemLink)
If TypeOf link Is BarSubItemLink Then
e.RibbonItemInfo.Appearance.ForeColor = Color.Red
End If
If link.Item.Name = "barButtonItem1" Then
If e.State = DevExpress.XtraBars.ViewInfo.BarLinkState.Highlighted Then
Using backBrush = New LinearGradientBrush(e.Bounds, Color.DarkGreen, Color.LightGreen, LinearGradientMode.BackwardDiagonal)
e.Cache.FillRectangle(backBrush, e.Bounds)
End Using
e.Graphics.DrawLine(Pens.White, e.Bounds.Location, New Point(e.Bounds.Right, e.Bounds.Y))
e.Graphics.DrawLine(Pens.Black, New Point(e.Bounds.X, e.Bounds.Bottom), New Point(e.Bounds.Right, e.Bounds.Bottom))
e.Graphics.DrawLine(Pens.White, e.Bounds.Location, New Point(e.Bounds.X, e.Bounds.Bottom))
e.Graphics.DrawLine(Pens.Black, New Point(e.Bounds.Right, e.Bounds.Y), New Point(e.Bounds.Right, e.Bounds.Bottom))
Else
e.Cache.FillRectangle(Brushes.LightSeaGreen, e.Bounds)
End If
e.DrawText()
e.DrawGlyph()
e.Handled = True
End If
If link.Item.Name = "barEditItem1" Then
If e.State = DevExpress.XtraBars.ViewInfo.BarLinkState.Highlighted Then
Using backBrush = New LinearGradientBrush(e.Bounds, Color.DarkOrange, Color.LightYellow, LinearGradientMode.BackwardDiagonal)
e.Cache.Graphics.FillRectangle(backBrush, e.Bounds)
e.Cache.Graphics.DrawLine(Pens.White, e.Bounds.Location, New Point(e.Bounds.Right, e.Bounds.Y))
e.Cache.Graphics.DrawLine(Pens.Black, New Point(e.Bounds.X, e.Bounds.Bottom), New Point(e.Bounds.Right, e.Bounds.Bottom))
e.Cache.Graphics.DrawLine(Pens.White, e.Bounds.Location, New Point(e.Bounds.X, e.Bounds.Bottom))
e.Cache.Graphics.DrawLine(Pens.Black, New Point(e.Bounds.Right, e.Bounds.Y), New Point(e.Bounds.Right, e.Bounds.Bottom))
End Using
Else
e.Cache.FillRectangle(Brushes.Yellow, e.Bounds)
End If
e.DrawText()
e.DrawGlyph()
e.DrawEditor()
e.Handled = True
End If
End Sub
End Class
End Namespace