I have read the previous posts about how to change the disabled forecolor but I still have a couple of questions.
I have over ridden the OnEnabledChanged method in a custom txtBox as follows-
protected override void OnEnabledChanged(EventArgs e)
{
base.OnEnabledChanged(e);
if (Enabled == false)
{
SetStyle(ControlStyles.UserPaint, true);
}
else
{
SetStyle(ControlStyles.UserPaint, false);
}
}
When the txtBox is enabled, UserPaint is set to false and therefore I expected any entered text to appear as normal. In fact, the font changes to a larger size and is bold unless I uncomment the line which sets the font size above. The code in the over ride of OnPaint() works fine to change the font color and background color of the disabled txtBox.
There are two problems with a custom combobox. When I use it with items added to it programmatically, the height of the combobox is adjusted, presumably to accommodate a larger font even though I have specified the font size as above, so the text is offset upwards.
If I use the combobox with its bindingsource set and the DropDownStyle set to simple, when it is disabled the text is surrounded by a smaller grey rectangle (as it would be normally if disabled) with a thin white surround (white being the color I have set disabled backcolor to.
I would be grateful for any help.