ForeColor, BackColor: Windows FormsSpecify the ForeColor and BackColor properties in Windows Forms.
ForeColor, BackColor. Windows Forms can have colors. The ForeColor property adjusts the text color and some borders on controls. The BackColor property meanwhile adjusts the background of controls. These two properties are available on many control instances.
ForeColor changes the color of controls. In Windows Forms, many controls have this property as well as a BackColor property. The ForeColor property typically adjusts the text color. It adjusts the border on buttons.
you can add a Button control to your Windows Forms project by double-clicking on the Button element in the Toolbox. Next, right-click on the button and select Properties. After this, please scroll down to the ForeColor entry.
Tip: In Visual Studio, you can set the default ForeColor for the control. During execution, you can adjust the ForeColor with C# code.
In the example screenshot,
the ForeColor was set to red. Because the control is a Button control, the border also changed to red. This varies depending on what visual appearance is enabled for Windows.
Note: You will just have to try and see how a control looks after setting ForeColor.
The ForeColor property
is a perfect complement to the BackColor property in Windows Forms. Please remember that if you adjust the ForeColor, you should adjust the BackColor so the text can be read.
Also: By using the system defaults or other system colors, you can ensure readability in more cases.
BackColor refers to background color. The BackColor property in Windows Forms gives you the ability to change the background color of a window or other control. Foreground colors, and nested objects in the form, will not be affected.
a new Windows Forms project and then right-click on the control or form itself. Select properties, and then scroll to BackColor. You can change the BackColor using the user interface in Visual Studio.
Tip: For many projects, using a system-dependent color is best. It will coordinate with other system colors.
You can also
modify the BackColor property in the C# code of your project. Please assign the property "this.BackColor" to a Color instance. Also, other controls, not just forms, have BackColor properties that are equivalent in meaning.
Tip: The BackColor property in Windows Forms provides a mechanism for mutating the background color of a window or control.
Typically: Using a system value for the background is best, as it will ensure that foreground elements are visible upon the background.
Summary. We examined the ForeColor and BackColor properties in Windows Forms. When you set one of these properties, it is often a good idea to set the other. This prevents illegible combinations: white text on a white background, for example.
© 2007-2020 Sam Allen. Every person is special and unique. Send bug reports to email@example.com.