Click here to Skip to main content
15,879,095 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good Morning,

I have a combobox in c#, and I need change the border color of drop down list,

How I can do this?

Thanks :)
Posted
Updated 20-May-13 3:07am
v2
Comments
CHill60 20-May-13 8:54am    
Use the Improve question button to add some more information to ensure that your question gets the correct solution. What kind of combobox are you using (i.e. is this WPF, ASP, WinForms)? Do you just want the border of the combobox coloured or the whole dropdown
OliveiraGui 20-May-13 9:02am    
WinForm , a normal combobox

1 solution

You need to custom draw it - the standard ComboBox doesn't allow you to customize the appearance of the drop down list.

This example might be of help to you:

Appearance Customizable ComboBox[^]

But I don't know if it even allows changes to the drop down list, or only to the textbox part.

Generally, this is quite hard to do, and it'll probably take you a long time to figure out and get sorted. Are you really sure that it's worth the time?
 
Share this answer
 
v2
Comments
OliveiraGui 20-May-13 8:58am    
I saw the Article, but i not find how i can change the border, nothing event or methods :/
Johnny J. 20-May-13 9:03am    
There are no event or methods for that. That's why you need to use userpainting and overwrite the standard painting routines to do what you want. It's not for beginners and people with heart problems.

Here's another article that shows how to customize the drop down list by painting the items with special fonts:

http://www.codeproject.com/Articles/9752/Managed-Font-Combobox

That's not exactly what you want either, but I doubt that you are going to be able to find an example that does exactly what you want and nothing else. You will probably have to meddle around a lot with the user painting to find the solution.

That's why I asked you if you're really sure it's worth all the trouble it's going to take to make it work.

But if you DO make it work, I really hope that you're going to write an article about it here on the CP... ;-)
OliveiraGui 20-May-13 9:08am    
hehehe , yeah this is really.

But i need do this :/

If i make this i post a article :)
Johnny J. 21-May-13 4:46am    
I thought it was a quite interesting problem, so I did a sample for you here:

http://www.codeproject.com/Tips/595936/Ownerdrawn-ComboBox-example

If you like it, please upvote and approve the solution... ;-)

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