尽管采用了防闪烁技术,仍会闪烁 [英] Flickering despite anti-flicker techniques

查看:148
本文介绍了尽管采用了防闪烁技术,仍会闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我以旋转滑块的形式为我的应用程序创建了一个惊人的控件,它被闪烁破坏了。



它由3个元素组成:

•valueCircle,一个OvalShape,其中绘制一个饼来表示值,导致闪烁

•转动旋钮

•缺口



[查看图像]



我尝试创建一个继承自OvalShape的类,覆盖onPaint,将pe.Graphics中的所有相关属性更改为HighQuality然后调用MyBase.onPaint(pe),使用新的高质量设置(换句话说,按照每个教程去除闪烁)无济于事。



我明白在mo中重绘馅饼使用移动事件很费力,但这是我能想到达到预期效果的唯一方法。



任何帮助都将受到赞赏。



谢谢,



Rix



我有什么尝试:



上doublebuffering

解决方案
我建议以下所有的教程在那里解决这个问题:

- 你的旋钮控件应该来自Control - 它不应该是UserControl。

- 不要使用进一步的控件 - 自己绘制它们。

- 在你的内部覆盖OnPaint-Method并自己做所有必要的绘图。所以你只需要使一个Control无效而不是3

- 可能的选择可能是:你把你的旋钮和刻度(如果有的话)绘制成一个图像(开头一次 - 在HandleCreated之后)或在调整控件大小后)。如果您现在更改旋钮的值(点上的位置),您首先绘制已保存的图像,然后绘制新位置处的点。



每个这些步骤可以更快地重新绘制控件(并减少闪烁)。


Hi,

I've created an amazing control for my application in the form of a rotating slider, which is being ruined by flickering.

It consists of 3 elements:
• valueCircle, an OvalShape, in which a pie is drawn to represent the value, causing the flickering
• the turning knob
• the notch

[View Image]

I tried creating a class inheriting from OvalShape, overrode onPaint, changed all of the relevant properties in pe.Graphics to HighQuality and then called MyBase.onPaint(pe), using the new high quality settings (in other words, followed every tutorial out there for removing flickering) to no avail.

I understand that redrawing the pie in the mouse move event is taxing, but it's the only way I can think of to achieve the desired effect.

Any help would be appreciated.

Thanks,

Rix

What I have tried:

All tutorials out there on doublebuffering

解决方案

I suggest the following to solve this problem :
- your knob-control should derive from Control - it should not be a UserControl.
- Don't use further controls - paint them by yourself.
- inside this your override the OnPaint-Method and do all necessary drawing by yourself. So you only have to Invalidate one Control instead of 3
- possible optimation could be : you draw your knob and the scale (if you have one) into an image (one time at the beginning - after HandleCreated or after Resizing the Control). If you now change the value of the knob (the location of the dot on it) you first draw the saved image and then the dot at it's new location.

Each of this steps will make the repainting of your control much faster (and reduces the flickering).


这篇关于尽管采用了防闪烁技术,仍会闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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