Problem in ToolStripComboBoxItem arrow paint (VS.Net 2010, WinForms).


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Problem in ToolStripComboBoxItem arrow paint (VS.Net 2010, WinForms).

  1. #1
    Join Date
    Mar 2009
    Posts
    67

    Question Problem in ToolStripComboBoxItem arrow paint (VS.Net 2010, WinForms).

    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.

    Code:
    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:

    Code:
    MyToolStrip.Renderer = New CustomRenderer

  2. #2
    Join Date
    Mar 2009
    Posts
    67
    ToolStripComboBox is a regular combobox that is hosted in ToolStripControlHost. ToolStripItem arrows is as mentioned the menu children indicators and is not related to that. You may be able to utilize the code to custom paint ComboBox here: Painting right arrow in ToolStripComboBox

Similar Threads

  1. vs.net problem
    By onderaydogan in forum ASP.NET
    Replies: 5
    Last Post: 10-02-2002, 01:39 PM
  2. Problem with paint (Graphics g )
    By Alan in forum Java
    Replies: 1
    Last Post: 03-12-2002, 10:21 PM
  3. Replies: 0
    Last Post: 02-07-2002, 07:41 PM
  4. PROBLEM: Creating Web App in VS.Net
    By jude kaider in forum ASP.NET
    Replies: 0
    Last Post: 12-10-2001, 12:40 PM
  5. Compilation problem with WinForms
    By Daniel Pratt in forum .NET
    Replies: 5
    Last Post: 08-29-2000, 01:12 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center