hi, im making my own menustrip control since i want to add a few things to
it. but now im stuck on how when you click on for instance a main node of
"File", it always is highlighted in one color....i cant figure out how to
change this, be it on the normal one or how to override this by making my
own....any help would be great
When I want to customize a MenuStrip, ToolStrip,or StatusStrip, I use
the ToolStripProfessionalRenderer class which has a number of
properties that can be assigned custom colors for all of the above.
This example produces a SlateGray gradient when the cursor is over a
MenuItem:
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
ToolStripManager.Renderer = New _
ToolStripProfessionalRenderer _
(New CustomProfessionalColors())
End Sub
Public Class CustomProfessionalColors
Inherits ProfessionalColorTable
Public Overrides ReadOnly Property MenuItemSelectedGradientBegin()
_ As System.Drawing.Color
Get
Return Color.White
End Get
End Property
Public Overrides ReadOnly Property MenuItemSelectedGradientEnd() _
As System.Drawing.Color
Get
Return Color.SlateGray
End Get
End Property
Public Overrides ReadOnly Property MenuItemBorder() _
As System.Drawing.Color
Get
Return Color.MidnightBlue
End Get
End Property
End Class
The above is only valid on target systems with VisualStyles enabled.
Gene