Stop ToolStripStatusLabel from flickering due to amount of data from datatable

44 Views Asked by At

I've got a ToolStripStatusLabel with data loading in live, there is so much information coming through that it becomes unreadable.

Is there any double buffer function for this? I have tried the following:

public static void DoubleBufferedToolStripStatusLabel(this ToolStripStatusLabel tssl, bool setting)
{
     Type dgvType = tssl.GetType();
     PropertyInfo pi = dgvType.GetProperty("DoubleBuffered", 
     BindingFlags.Instance | BindingFlags.NonPublic);
     pi.SetValue(tssl, setting, null);
}
1

There are 1 best solutions below

0
On BEST ANSWER

How about only updating it every second, rather than every time it needs updating?

DateTime _lastUpdated = DateTime.MinValue;

void UpdateStatusLabel(string text)
{
    if(DateTime.Now > _lastUpdate)
    {
        ToolStripStatusLabel.Text = text;
        _lastUpdate = DateTime.Now + TimeSpan.FromSeconds(1);
    }
}