Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 textBox 中显示 float 类型的温度,它每 15 秒更新一次。当前 textBox 显示每个更新的温度值,但我希望 textBox 仅显示更新温度的最后三个值,因此如果第四次更新温度,则 textBox 应该最后丢弃温度,应该只显示三个温度值。他们有什么方法可以实现这一目标吗?我正在使用以下代码来显示温度:-
textBox.AppendText("\r\n" + temp);
尝试这个,
string[] temp = {"0","1","2"}; for (int i = 0; i < 3; i++) { temp[i] = Convert.ToString( i + ","); textBox1.AppendText("\r\n" + temp[i]); }