All the control properties we've set interactively in the Properties window while using the Web Forms designer, such as ForeColor or input Mode for a TextBox, can also be set within our program. For example, to dynamically reset the Mode, Width, and ForeColor of a TextBox, we would write the following,
TextBox1.Mode = TextBoxMode.SingleLine; TextBox1.Width = new Unit( 200, UnitType.Pixel ); TextBox1.ForeColor = Color.Red;
where TextBoxMode and UnitType are enumeration types of alternative property values, and Red is a static property of the Color class.
Color provides many named colors, such as Black, Blue, BlanchedAlmond, and BurlyWood.
In addition to changing the properties of an existing control, we ...