当刷新DataGridView的我闪烁 [英] My DataGridView blinks when refreshing
本文介绍了当刷新DataGridView的我闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我刷新我的DataGridView一些数据,我失去了我的重点放在选定单元格和随机文字闪烁
为什么会出现这种情况?在其他应用程序,我不看这个问题,这样我就可以解决这个问题,但如何
我这段代码刷新数据:
SBind.DataSource = DTable; // SBind被绑定我grid.DataSource = SBind
SBind.ResetBindings(假);
解决方案
试试这个:
SBind.SuspendLayout();
SBind.DataSource = DTable;
SBind.ResetBindings(假);
SBind.ResumeLayout(真);
您也可以尝试启用的 DoubleBuffered
您的网格是这样的:
typeof运算(控制).GetProperty(DoubleBuffered,BindingFlags.NonPublic可| BindingFlags.Instance)
.SetValue(SBind,真实,NULL);
If I refresh some data in my datagridview, I lose my focus on selected cells and random text blinks.
Why does this happen? In other apps I don't see this problem, so I can fix this, but how?
I refresh data by this code:
SBind.DataSource = DTable; // SBind is binded my grid.DataSource = SBind
SBind.ResetBindings(false);
解决方案
Try this:
SBind.SuspendLayout();
SBind.DataSource = DTable;
SBind.ResetBindings(false);
SBind.ResumeLayout(true);
You can also try enabling the DoubleBuffered
of your grid like this:
typeof(Control).GetProperty("DoubleBuffered", BindingFlags.NonPublic | BindingFlags.Instance)
.SetValue(SBind, true, null);
这篇关于当刷新DataGridView的我闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文