2012-04-03 8 views

Respuesta

24
TextBox1.ForeColor = Color.Red; 
TextBox1.Font.Bold = True; 

O esto se puede hacer usando un CssClass (recomendado):

.highlight 
{ 
    color:red; 
    font-weight:bold; 
} 

TextBox1.CssClass = "highlight"; 

O los estilos se pueden añadir en línea:

TextBox1.Attributes["style"] = "color:red; font-weight:bold;"; 
3

Try usando la propiedad ForeC olor De esta manera:

TextBox1.ForeColor = Color.Red; 
1
string minusvalue = TextBox1.Text.ToString(); 

if (Convert.ToDouble(minusvalue) < 0) 
{ 
    // set color of text in TextBox1 to red color and bold. 
    TextBox1.ForeColor = Color.Red; 
} 
Cuestiones relacionadas