Click here to Skip to main content
15,890,717 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
i'm trying to change the colour of the text in the combobox when it's enabled = false, but it's alway gray.

i am using vs2008, c#, compact framework 2.0 for pocketpc

can you help me or give me some suggest?
Posted
Comments
Henry Minute 29-Sep-10 7:45am    
Sorry, forgot it was cf. I'm not familiar with it too well so cannot assist.

It's gray because that is the standard for disabled items. By adhering to the standard users get to instantly recognize controls that are not currently useable.

If you want to modify this then I would suggest that you try the .ReadOnly property instead of the .Enabled one. that will give you a bit more freedom, although I cannot remember off the top of my head if it will allow what you want.
 
Share this answer
 
Comments
[no name] 29-Sep-10 6:45am    
in the cf 2.0 the combobox has not a Readonly value!
ok, i have to create my own custom combo, but how i can block the change of the value if my Readonly = true?
which event i have to catch?

i found a similar solution with a custom textbox: it block the area catching the OnKeyPress event
protected override void OnKeyPress(KeyPressEventArgs e)
{
if (m_Locked)
{
e.Handled = true;
}
base.OnKeyPress(e);
}

but with a combobox i haven't a OnKeyPress event!
[no name] 29-Sep-10 6:46am    
what i want to do is: if the combobox is enabled = false then textcolor (forecolor) = Red and background = black
[no name] 30-Sep-10 3:03am    
i tried to override the OnPaint event but it's not called in anyway ... strange!! so i have disassembled the combobox class and saw that in the WnProc() there's no calling the OnPaint event ...damn!! and i cannot override it because it has come internal methods and variables (of the Control class).
someone has a good idea to modify it?
There is no readonly on a combobox. Working with the owner draw is very difficult. And changing the forecolor of the combo does not impact the disabled color of the text. My users really don't care about someone else's idea of a standard. They need to be able to read the text. Black text on a control colored background is much more legible. ALL of our other custom controls enforce this standard. The combo box is completely different from all the other controls. Where is the standard here? :confused: Why is this so difficult?
 
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