You can change the style of all the Input controls using different color and font styles provided by their respective classes. To start with, you can easily set the foreground and background color of the input controls by using the ForeColor and BackColor properties, respectively.
The following image showcases different foreground and background color applied to a TextBox control.
The following code sets the background and foreground color of an Input control, TextBox. For this, we used BackColor and ForeColor properties of the C1TextBox class to set the background and foreground colors, respectively.
C# |
Copy Code
|
---|---|
//Style the TextBox control
c1TextBox1.BackColor = System.Drawing.Color.Bisque;
c1TextBox1.ForeColor = System.Drawing.Color.DarkGreen;
|
Similarly, you can customize background and foreground color of other Input controls.
You can change the font style of all the Input controls using the Font property. For example, the following image showcases font styles applied to a textbox control.
The following code sets the font style for TextBox, an input control. In this example, Font property is used to set the font family, font type, and font size of the TextBox control.
C# |
Copy Code
|
---|---|
//Set Font style c1TextBox1.Font = new System.Drawing.Font("Times New Roman", 11F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point); |
Similarly, you can set font styles in other Input controls as well.