且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何更改标签盒颜色

更新时间: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 :)