Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I reset a .NET Windows Forms TextBox BackColor property?

The default behavior of property BackColor of a TextBox is as follows: when enabled, it is White (SystemColors.Window), when disabled it is Gray (not sure what SystemColor this is).

If I change the BackColor property, the same color is used for both Enabled and Disabled. How do I reset the BackColor property (after it has been changed previously) so that the behavior reverts to the default?

I have tried setting it back to SystemColors.Window, but then the box stays white when disabled.

like image 702
Patrick McDonald Avatar asked Apr 17 '09 14:04

Patrick McDonald


People also ask

How do I change BackColor in C#?

To change the background color of text in Console, use the Console. BackgroundColor Property in C#.

How do you change the BackColor in VBA?

Changing background colors in Excel VBA is easy. Use the Interior property to return an Interior object. Then use the ColorIndex property of the Interior object to set the background color of a cell.

How do I change BackColor in VB net?

To change the background color, select the form in Visual Studio and locate the BackColor property in the Properties panel. There are a number of ways to specify a color. Color by name - Simply type in a color name into the BackColor value field (for example Red, Yellow, Cyan etc).


1 Answers

If you mean in the designer, you can just click into the BackColor property and delete whatever is in there and then press enter. This will reset the property back to its default value.

If you mean in code, you can set the BackColor property to Color.Empty, and this will have the same effect.

like image 114
dustyburwell Avatar answered Oct 27 '22 11:10

dustyburwell