2017-08-16 39 views
0

此代碼需要15秒來執行:Colums.AddRange是減緩

this.gridView1.Columns.AddRange(Coloms.ToArray());//the number of Coloms is big 

我能做些什麼,以加快步伐?

+0

你有多少列? –

+0

Coloms是一個lsit包含200+ –

回答

2

嘗試禁用視覺更新。

this.gridControl1.BeginUpdate(); 
this.gridView1.Columns.AddRange(Coloms.ToArray()) 
this.gridControl1.EndUpdate();  

the documentation說明:

的方法的BeginUpdate之後被調用,當前打開的 查看被鎖定,並不能反映他們的 外觀設置所做的任何更改。調用EndUpdate方法將解鎖並重繪視圖。

+0

非常感謝。它的工作。請問爲什麼要添加這兩個代碼? –