BackColor of a disabled NumericUpDown

  • Thread starter Thread starter nobody
  • Start date Start date
N

nobody

When I set a TextBox to .Enabled=False, it's back color changes to a light
gray.. When I set a NumericUpDown to .Enabled=False, it's back color
doesn't change. Is this "non-standardized behaviour" by design?
 
I am running VS.NET 2003 / .NET Framework 1.1 and the backcolor of the
numeric up/down *does* go gray when it's enabled property is set to false.
This however only occurs during runtime. If you preset it to disabled in
the designer then the backcolor stays white until runtime.

Gary
 
Well I'll be... So you're right. My problem was that I had changed the
..BackColor to something different and then set it back to "Windows" using
the Properties window at design time. Once you do that, even though you set
the color back to Windows, setting .Enable=False no longer grays the box.
You have to hi-lite the .BackColor property in the Properties window and hit
delete. It'll still say "Windows" (no longer Bold) but then .Enable=False
will gray the box. Strange.

Thanks for making me take another look, I probably would never have figured
that out. I was already setting it's .BackColor to
Color.FromArgb(128,128,128) or Color.FromKnownColor(KnownColor.Window) when
the UserControl's EnableChanged(...) event fired.
 
Just a follow up on my problem/resolution... In code you can set the
..BackColor to Nothing to reset the graying ability when .Enable=False. If
..Enable=False already when you set the .BackColor=Nothing then you have to
set it to True and back to False after setting the .BackColor=Nothing in
order for the control to turn gray.
 
Back
Top