我也在反对这件事。这是我为那些正在寻找的人提供的解决方案。将其添加到treeview子类中。
代码语言:javascript复制 private const int WM_VSCROLL = 0x0115;
private const int WM_HSCROLL = 0x0114;
private const int SB_THUMBTRACK = 5;
private const int SB_ENDSCROLL = 8;
private const int skipMsgCount = 5;
private int currentMsgCount;
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_VSCROLL || m.Msg == WM_HSCROLL)
{
var nfy = m.WParam.ToInt32() & 0xFFFF;
if (nfy == SB_THUMBTRACK)
{
currentMsgCount++;
if (currentMsgCount % skipMsgCount == 0)
base.WndProc(ref m);
return;
}
if (nfy == SB_ENDSCROLL)
currentMsgCount = 0;
base.WndProc(ref m);
}
else
base.WndProc(ref m);
}我的想法是:treeview scrollbar event
基本上,我只是忽略了很大一部分滚动消息。它为我减少了很多闪烁。
