VB 更改颜色边框菜单条
VB change color border menustrip
我在我的应用程序中添加了一个菜单条,我想更改菜单条上的边框颜色。我找到了一些代码,但是你可以在图片上看到我又有了边框。
图片:
我的代码:
Public Class ColorTable
Inherits ProfessionalColorTable
Dim Color1 = Color.FromArgb(30, 38, 44)
Dim Color2 = Color.FromArgb(75, 81, 88)
Public Overrides ReadOnly Property MenuBorder() As Color
Get
Return Color1
End Get
End Property
Public Overrides ReadOnly Property MenuItemSelectedGradientBegin() As Color
Get
Return Color2
End Get
End Property
Public Overrides ReadOnly Property MenuItemSelectedGradientEnd() As Color
Get
Return Color2
End Get
End Property
Public Overrides ReadOnly Property MenuItemSelected() As Color
Get
Return Color2
End Get
End Property
Public Overrides ReadOnly Property MenuItemBorder() As Color
Get
Return Color1
End Get
End Property
Public Overrides ReadOnly Property MenuItemPressedGradientBegin() As Color
Get
Return Color2
End Get
End Property
Public Overrides ReadOnly Property MenuItemPressedGradientEnd() As Color
Get
Return Color2
End Get
End Property
End Class
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Menus.Renderer = New ToolStripProfessionalRenderer(New ColorTable())
End Sub
您还需要覆盖以下属性:
Public Overrides ReadOnly Property SeparatorDark() As Color
Get
Return Color1
End Get
End Property
Public Overrides ReadOnly Property ToolStripDropDownBackground() As Color
Get
Return Color1
End Get
End Property
这将覆盖背景和您偶然添加的任何分隔符。
我已经添加了
Public Overrides ReadOnly Property ImageMarginGradientBegin() As System.Drawing.Color
Get
Return Color1
End Get
End Property
Public Overrides ReadOnly Property ImageMarginGradientEnd() As System.Drawing.Color
Get
Return Color1
End Get
End Property
Public Overrides ReadOnly Property ImageMarginGradientMiddle() As System.Drawing.Color
Get
Return Color1
End Get
End Property
现在一切正常:)
我在我的应用程序中添加了一个菜单条,我想更改菜单条上的边框颜色。我找到了一些代码,但是你可以在图片上看到我又有了边框。
图片:
我的代码:
Public Class ColorTable
Inherits ProfessionalColorTable
Dim Color1 = Color.FromArgb(30, 38, 44)
Dim Color2 = Color.FromArgb(75, 81, 88)
Public Overrides ReadOnly Property MenuBorder() As Color
Get
Return Color1
End Get
End Property
Public Overrides ReadOnly Property MenuItemSelectedGradientBegin() As Color
Get
Return Color2
End Get
End Property
Public Overrides ReadOnly Property MenuItemSelectedGradientEnd() As Color
Get
Return Color2
End Get
End Property
Public Overrides ReadOnly Property MenuItemSelected() As Color
Get
Return Color2
End Get
End Property
Public Overrides ReadOnly Property MenuItemBorder() As Color
Get
Return Color1
End Get
End Property
Public Overrides ReadOnly Property MenuItemPressedGradientBegin() As Color
Get
Return Color2
End Get
End Property
Public Overrides ReadOnly Property MenuItemPressedGradientEnd() As Color
Get
Return Color2
End Get
End Property
End Class
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Menus.Renderer = New ToolStripProfessionalRenderer(New ColorTable())
End Sub
您还需要覆盖以下属性:
Public Overrides ReadOnly Property SeparatorDark() As Color
Get
Return Color1
End Get
End Property
Public Overrides ReadOnly Property ToolStripDropDownBackground() As Color
Get
Return Color1
End Get
End Property
这将覆盖背景和您偶然添加的任何分隔符。
我已经添加了
Public Overrides ReadOnly Property ImageMarginGradientBegin() As System.Drawing.Color
Get
Return Color1
End Get
End Property
Public Overrides ReadOnly Property ImageMarginGradientEnd() As System.Drawing.Color
Get
Return Color1
End Get
End Property
Public Overrides ReadOnly Property ImageMarginGradientMiddle() As System.Drawing.Color
Get
Return Color1
End Get
End Property
现在一切正常:)