This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.vb
47 lines (45 loc) · 1.77 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
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms
Imports System.Drawing.Drawing2D
Imports DevExpress.XtraNavBar.ViewInfo
Imports DevExpress.XtraNavBar
Imports DevExpress.Utils.Drawing
Namespace NavBarSample
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub navBarControl1_CustomDrawLink(ByVal sender As Object, ByVal e As DevExpress.XtraNavBar.ViewInfo.CustomDrawNavBarElementEventArgs) Handles navBarControl1.CustomDrawLink
If e.ObjectInfo.State = ObjectState.Hot OrElse e.ObjectInfo.State = ObjectState.Pressed Then
Dim brush As LinearGradientBrush
Dim linkInfo As NavLinkInfoArgs = TryCast(e.ObjectInfo, NavLinkInfoArgs)
If e.ObjectInfo.State = ObjectState.Hot Then
brush = New LinearGradientBrush(e.RealBounds, Color.Orange, Color.PeachPuff, LinearGradientMode.Horizontal)
Else
brush = New LinearGradientBrush(e.RealBounds, Color.PeachPuff, Color.Orange, LinearGradientMode.Horizontal)
End If
e.Graphics.FillRectangle(Brushes.OrangeRed, e.RealBounds)
Dim rect As Rectangle = e.RealBounds
rect.Inflate(-1, -1)
e.Graphics.FillRectangle(brush, rect)
If e.Image IsNot Nothing Then
Dim imageRect As Rectangle = linkInfo.ImageRectangle
imageRect.X += (imageRect.Width - e.Image.Width) / 2
imageRect.Y += (imageRect.Height - e.Image.Height) / 2
imageRect.Size = e.Image.Size
e.Graphics.DrawImageUnscaled(e.Image, imageRect)
End If
e.Appearance.DrawString(e.Cache, e.Caption, linkInfo.RealCaptionRectangle, Brushes.White)
e.Handled = True
End If
End Sub
End Class
End Namespace