在摇曳ListView控件(的OwnerDraw,虚拟) [英] Flickering in ListView control (OwnerDraw, Virtual)

查看:207
本文介绍了在摇曳ListView控件(的OwnerDraw,虚拟)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题可能被认为是后续<一个href=\"http://stackoverflow.com/questions/938896/flickering-in-listview-with-ownerdraw-and-virtualmode\">this问题。

This question might be considered a follow-up to this question.

我有在虚拟模式 A 的ListView 控制和我尝试执行自定义绘制。项呈现经由以下方法重写完成:

I've got a ListView control in Virtual mode and I attempt to perform custom drawing. Item rendering is done via the following method override:

protected override void OnDrawItem(DrawListViewItemEventArgs eventArgs) 

作为引用问题中提到,自定义绘制的介绍了事件的鼠标闪烁。调试器告诉我出现这种情况是由于一个的过量的自定义绘制这些被解雇的事件。

As mentioned in the referenced question, custom drawing introduces flickering on mouse over events. Debugger tells me this happens due to an excessive amount of custom draw events which are fired.

现在 - 接受的答案被引用的问题告诉我们:

Now - the accepted answer to the referenced question tells us:

这是在.NET中的ListView中的错误,你可以围绕它通过不了
  双缓冲。

This is a bug in .NET's ListView and you cannot get around it by double buffering.


  • 因此​​,如何可靠的信息?是一个真正的的错误?的或许我们只是试图切断消息的一部分,并希望它不会改变可见的行为?

  • So, how reliable is that information? Is that really a bug? Or maybe we simply attempt to cut off a part of the messages and hope that it won't alter the visible behavior?

    这是真的,如果我对的ListView 我的所有者绘制函数在虚拟模式,我可以燮preSS这些自定义绘制事件,仅在 WM_PAINT 或者,也许,这是执行我的画不正确的某些情况下?

    Is this true that if I have my owner drawing routine for the ListView in Virtual Mode, I can suppress these Custom Draw events and only perform my drawing in WM_PAINT or, maybe, this is incorrect for some cases?

    有哪些 System.Windows.Forms的控制prerequisities,能够做所有的画 WM_PAINT 而不改变它最初的行为?

    What are the prerequisities for the System.Windows.Forms control to be able to do all the painting in WM_PAINT without altering it's initial behavior?

    感谢您(对不起我的英语不好)。

    Thank you (sorry for my bad English).

    推荐答案

    我见过,在任何自定义绘制事件处理程序(DRAWITEM,DrawSubItem)ListView控件这种闪烁问题。我试过的BeginUpdate()/ EndUpdate()和双缓冲没有成功。我认为.NET触发额外的WM_PAINT所有列为自定义绘制栏的右侧

    I've seen this flickering issue with ListView control in any custom rendering event handlers (DrawItem, DrawSubItem). I tried BeginUpdate()/EndUpdate() and double buffering with no success. I think .NET triggers additional WM_PAINT to all columns to the right of the custom drawn column.

    不过,我发现这个解决方法,以单个自定义渲染列的ListView。它的工作原理就好了!

    However I found this workaround to a single custom rendered column ListView. It works just fine!


    1. 在编辑器的columnHeader,设置绘制列自定义的最后一列

    2. 更改你想要的位置的DisplayIndex

    这应该解决了闪烁在鼠标悬停或运行时渲染。

    This should solve the flickering in mouseover or run-time rendering.

    这篇关于在摇曳ListView控件(的OwnerDraw,虚拟)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆