0%

winfrom 减少闪烁

winfrom 反射实现ListView 和 DataGridView 双缓冲功能

1
lv.GetType().GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(dgv, true, null);
1
2
3
4
5
6
protected override void WndProc(ref Message m)  
{
if (m.Msg == 0x0014) // 禁掉清除背景消息
return;
base.WndProc(ref m);
}
1
2
3
4
5
this.SetStyle(ControlStyles.DoubleBuffer |     
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint,
true);
this.UpdateStyles();
-------------本文结束感谢您的阅读-------------