在 C# 中闪烁列表框

Flashing listBox in c#

我想知道是否可以刷新列表框。 我正在用 c# 和 winform 创建一个聊天应用程序(客户端-服务器),我想让我的列表框在收到新消息时闪烁。 这是可能的 ?谢谢

您好"Flash"意思是清楚吗?

如何:在列表框控件中添加和清除项目
https://msdn.microsoft.com/en-us/library/ms228375(v=vs.90).aspx

private void button1_Click(object sender, System.EventArgs e)
{
   listBox1.Items.Add("Sally");
   listBox1.Items.Add("Craig");
}

private void button2_Click(object sender, System.EventArgs e)
{
   listBox1.Items.Clear();
}

你的意思是这样的吗?

var originalColor = listBox1.BackgroundColor;
listBox1.BackgroundColor = Color.LightYellow;
await Task.Delay(new TimeSpan(0, 0, 0, 0, 100));
listBox1.BackgroundColor = originalColor;