更新时间:2023-10-19 22:20:28
在为标签分配值时
While assigning value to the label
//lblYourLabel.Text="-1990";
//just after value assignment
lblYourLabel.ForeColor = int.Parse(lblYourLabel.Text) < 0 ? System.Drawing.Color.Red : System.Drawing.Color.Green;
希望,它有帮助:)
Hope, it helps :)