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
| Public Class MenuRendererDark
Inherits ToolStripProfessionalRenderer
Dim ColorUnsel As Color = Color.Black
Dim ColorSel As Color = String2Color("FF2F2F2F")
Protected Overloads Overrides Sub OnRenderMenuItemBackground(ByVal e As ToolStripItemRenderEventArgs)
' Item Color
Dim rc As New Rectangle(Point.Empty, e.Item.Size)
Dim c As Color = IIf(e.Item.Selected, ColorSel, ColorUnsel)
Using brush As New SolidBrush(c)
e.Graphics.FillRectangle(brush, rc)
End Using
End Sub
Protected Overrides Sub OnRenderSeparator(ByVal e As ToolStripSeparatorRenderEventArgs)
MyBase.OnRenderSeparator(e)
Dim ColorBrush As Brush = New SolidBrush(ColorUnsel)
' Separator Background
Dim backGround As New Rectangle(0, 0, e.Item.Width, e.Item.Height)
e.Graphics.FillRectangle(ColorBrush, backGround)
Dim blackLine As New Rectangle(32, 3, e.Item.Width - 32, 1)
e.Graphics.FillRectangle(Brushes.Black, blackLine)
Dim whiteLine As New Rectangle(32, 4, e.Item.Width - 32, 1)
e.Graphics.FillRectangle(Brushes.White, whiteLine)
End Sub
End Class |
Partager