Click here to Skip to main content
15,879,348 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I am using combo box in WinForm but when i was selected any item in combo box then selected item background color is blue. i want to remove this blue background color.
and i am using C#

please any one help me.
Posted
Comments
Toniyo Jackson 14-Apr-11 3:10am    
I think you can not change the color. I don't why know you need this?
#realJSOP 19-Apr-11 13:29pm    
Yes, you can change the color, but it's a system color, and is not generally acceptable practice to change it from within a given program just to suit that program.
BobJanova 14-Apr-11 5:52am    
This colour is an operating system cue to indicate highlights/selection. You should not remove it without good reason (and 'I don't think it looks nice' is *not* a good reason).

Are you speaking of the the blue which is higlighting as you move thru the combox's list or the blue which is higlighting the text after the item is selected? If you speaking of the later of the two that's simple in the selected index changed event handler make the last line of code focus on a different control:}
 
Share this answer
 
Ok... I know I will be downvoted for this, but I feel I have to do it.

Don't do it. And I mean it, don't.
UI conventions are there for a purpose.
For you to respect and follow them.
Because the users of your software are used to them.
Imagine, just imagine, that all the software you use, employs different UI styles / conventions...
Resulting in Mayhem...
Try to understand. This was the rule back then, in MS-DOS times.
That's why Windows was created.
For programs to act, look and feel similar.
To relieve the poor user of the burden of relearning the same stuff again and again.
If a program's user interface has weird, inconsistent approaches, I try not to use it.
So, for the sake of your presumptive users, don't do it!
Thank you,
A programmer, but also a user.

P.S. Let the user change the color, if so he wishes, by means of Control Panel.
 
Share this answer
 
v2
Comments
Michel [mjbohn] 14-Apr-11 5:03am    
Why downvote?
My 5 :)
Toli Cuturicu 14-Apr-11 5:32am    
You know... The OP just wants answers / code, not advice... It just happens all the time.
Kevin Fawcett 22-Aug-12 9:51am    
I know this post is in the past, but as a user who just stumbled upon it, I don't agree with your advice in this case, though in other cases I would. I think I am having the same behavior as the OP where my ComboBox is highlighting with a dark blue using black text on legacy systems (It looks fine in Windows 7). This provides almost unreadable text and a bad user experience.

Plus you didn't answer the question.
BobJanova 14-Apr-11 5:53am    
100% agreed. OS highlight colours and other standard colours are there for good reason and should be respected.
charles henington 14-Apr-11 8:46am    
maybe he want's to apply his own background color?
i think you can accomplish this by handling DrawItem event.
see (ComboBox.DrawItem Event[^]).
 
Share this answer
 
Comments
Member 10236318 31-Mar-15 17:43pm    
Wow the person wanted and answer as I do on this. Just claiming it's not good practice, or you should not do it, shows you really don't have the answer but are just trying to sound important. Custom controls and user preference make this a very reasonable question. We really get tired of hearing and seeing this kind garbage posted as a response. I wish when this kind of mindless drizzle is found, CodeProject would remove it.
Ali Al Omairi(Abu AlHassan) 2-Apr-15 18:52pm    
Thank you for the advice "Member 10236318" i would consider it.

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