ListView閃爍太厲害,如何為它開啟DoubleBuffered
系統自帶的ListView閃爍太厲害了,用:BeginUpdate/EndUpdate 也是一樣。
DELPHI中的ListView有一個DoubleBuffered屬性,請問高手,如何用C#來實現它功能?
------解决方案--------------------public class myListView : ListView
{
public bool DoubleBuffer
{
get { return base.DoubleBuffered; }
set { base.DoubleBuffered = value; }
}
}
重写doublebuffered
------解决方案--------------------你需要从TreeView继承一个新的类以打开这个选项,但这样你需要重写OnPaint来自已绘制树,代码如下:
class tree:TreeView
{
public tree()
{
this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
//code here
}
}