如何滚动时消除闪烁Windows.Forms的中自定义的控制? [英] How to eliminate flicker in Windows.Forms custom control when scrolling?

查看:195
本文介绍了如何滚动时消除闪烁Windows.Forms的中自定义的控制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建在C#中的自定义控制。但每次我都完全重绘我的控制,它闪烁,即使我使用双缓冲(画上一个形象第一,和块传输的)。

I want to create a custom control in C#. But every time I have to fully redraw my control, it flickers, even if I use double buffering (drawing to an Image first, and blitting that).

我如何消除闪烁时,我有完全重绘?

How do I eliminate flicker when I have to fully redraw?

推荐答案

您可以尝试把在InitiliseComponent通话后你的构造如下。

You could try putting the following in your constructor after the InitiliseComponent call.

SetStyle(ControlStyles.OptimizedDoubleBuffer | 
         ControlStyles.UserPaint |
         ControlStyles.AllPaintingInWmPaint, true);

编辑:

如果你给这个一展身手,如果可以,删除自己的双缓冲code,只是有控制绘制自身应对被称为相应的虚拟方法。

If you're giving this a go, if you can, remove your own double buffering code and just have the control draw itself in response to the appropriate virtual methods being called.

这篇关于如何滚动时消除闪烁Windows.Forms的中自定义的控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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