0

我是葡萄牙人,我的英语不是很好,对不起!

我在 .Net Windows Form Framework 3.5 中开发了一个项目。

我需要填充和刷新 DataGridView,有 350 条记录,每秒 5 次。

数据从 WebService 提供,我使用两个 Windows.Forms.Timer 调用异步方法,定时器间隔为 200 ms。

我创建了一个 BindingList:

public class Data : INotifyPropertyChanged
{
   private colunaA;
   private colunaB;
   private colunaC;
   public event PropertyChangedEventHandler PropertyChanged;

   public Data() { }

   public ColunaA { get { return this.colunaA; } set { if (this.colunaA != value) { this.colunaA = value; onpropertychanged("ColunaA"); } }
   ...

   private void onpropertychanged(string propertyName)
                {
                        if (PropertyChanged != null)
                        {
                                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
                        }
                }
}

并且计时器的 Tick 函数会更改 BindingList 数据。

我在 Windows 窗体方面的经验非常丰富,我需要听取您的意见。

实现每秒多次刷新350条数据记录的最佳方法是什么?和性能?

这种方法效果很好,但有时 DataGridView 不会按预期刷新!我现在不知道为什么,但我认为 BindingList 不能很好地处理许多信息并每秒刷新!

非常感谢,里卡多

4

0 回答 0