Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
I am rendering a toolstrip with a CustomRenderer that inherits from ToolStripProfessionalRenderer. The concept is that I want the color of the arrow of the toolstrip items to be white in all cases except selection. When it is selected the color should be black. In my code below all arrows are painted accordingly except the ToolStripComboBox where the color of the arrow always remains the same; the default one. How to sort it out?

Hope I don't need to write the whole class but only the relevant fragment. So I uploaded the OnRenderArrow method only.

VB
Friend Class CustomRenderer
    Inherits ToolStripProfessionalRenderer

    Sub New()
        
    End Sub

    Protected Overrides Sub OnRenderArrow(ByVal e As System.Windows.Forms.ToolStripArrowRenderEventArgs)
        If e.Item.Pressed Then
            e.ArrowColor = Color.White
        ElseIf e.Item.Selected Then
            e.ArrowColor = SystemColors.ControlText
        Else
            e.ArrowColor = Color.White
        End If

        MyBase.OnRenderArrow(e)
    End Sub
End Class


To render the toolstrip with the pertinent class:
VB
MyToolStrip.Renderer = New CustomRenderer
Posted

Have you seen this?

Toolstrip Customizer

This little app makes customizing your UI using a CustomRenderer really easy.
 
Share this answer
 
ToolStripComboBox is actually a regular ComboBox control that is hosted in a ToolStripControlHost. ToolStripItem arrows is as mentioned the menu children indicators and is not related to that. We need to custom paint the regular ComboBox.

Check this:
http://social.msdn.microsoft.com/forums/en-US/winforms/thread/d846c71b-d405-495f-9b6d-8d0b361a0aac/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900