Results 1 to 4 of 4

Thread: ComboBox Selection Color

  1. #1
    SQLServant is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Jan 2012
    Posts
    2
    Reputation
    0

    ComboBox Selection Color

    I have a Win Forms app written in vb.net. In it, I have a combo box with a Owner Draw Item routine. Using this routine, I am able to implement an application-wide default value for a selection color like shown below:

    ComboImage1.png
    This works great except for one tidbit: Once an item is selected, the combo box reverts to showing the system selection color again
    ComboImage2.png

    How can I also use my own selection color in the textbox portion of the combo box, after the user makes a selection?

  2. #2
    Tom Giles is offline VB.NET Forum Newbie
    .NET Framework
    .NET 3.5
    Join Date
    Jan 2012
    Location
    Ottawa, Ontario, Canada
    Posts
    2
    Reputation
    0
    Hi all, first post! Great forum.

    I have a very similar issue with the color parameter [system.windows.forms.combobox].ForeColor

    When I set forecolor, the color is never applied to the selected value, only the values in the list. Same goes for backcolor, so it's interesting to read your post.

    I'm using a dropdownlist type for the list - my Forecolor setting works when I use a DropDown style.

    Anyone have a fix to setting the DropDownList-type combobox selected-item text color? (phew... what a mouthful)

    Cheers
    Tom

  3. #3
    SQLServant is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Jan 2012
    Posts
    2
    Reputation
    0
    Adding the following line fixed my issue:
    Me.ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList

    I thought this line was unnecessary (a default value)... I was wrong.

  4. #4
    Tom Giles is offline VB.NET Forum Newbie
    .NET Framework
    .NET 3.5
    Join Date
    Jan 2012
    Location
    Ottawa, Ontario, Canada
    Posts
    2
    Reputation
    0
    Thanks for the reply sqlservent. Interesting line, I will have to try it out.

    I fixed my color issue with setting the FlatStyle=Flat. This changed the nice visual appearance to a more win xp style but it worked.

    Cheers
    Tom

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking