忽明忽暗"的CreateParams" [英] Flickering and "CreateParams"

查看:290
本文介绍了忽明忽暗"的CreateParams"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想避免闪烁在我的应用程序的面板,从 4 monthgs谷歌搜索后,前,试图子类面板,询问这里两三次,要求在其他论坛后后后...没有人有解决方案,但今天我发现在这最后答案的解决方案,通过一个奇迹:<一href="http://stackoverflow.com/questions/14430385/is-their-a-way-to-stop-the-picturebox-from-flickering-when-being-resized/14435859#14435859">Is他们的方式来阻止被调整时,闪烁的图片框?

I want to avoid flickering in a panel of my application, after googling from 4 monthgs ago, after trying subclassed panels, after asking here two or three times, after asking in other forums... nobody has the solution but today I've found the solution by a miracle in this last answer: Is their a way to stop the picturebox from flickering when being resized?

Protected Overrides ReadOnly Property CreateParams() As CreateParams
        Get
            Dim cp As CreateParams = MyBase.CreateParams
            cp.ExStyle = cp.ExStyle Or &H2000000
            Return cp
        End Get
End Property 'CreateParams

现在我想知道确实是的code线,我需要了解什么是做了code我的应用程序,

Now I want to know what really does that lines of code., I need to understand what is doing that code to my application,

是一个很好的方式来获得闪烁的避免?

is a good way to get avoid of flickering?

MSDN说:

CreateParams属性不应该被覆盖,用于调整派生控件的属性

"The CreateParams property should not be overridden and used to adjust the properties of your derived control"

但为什么不呢?这是我发现要真正走出我的面板闪烁所以这就是为什么我想知道更多关于code我上面贴的唯一途径,我想明白了所有的订单,也该子beneffits和底片,所有的东西都是欢迎...

but why not?, that is the only way I found to really get out my panel flickering so that's why I want to know more about the code I posted above, I want to understand all the orders, also the beneffits of that sub and the negatives, all things are welcome...

有人能更给我解释一下有关code?

Someone can explain me more about that code?

UPDATE:

我已经使用重写子测试时,在我所有的应用程序的闪烁的解决方案,并肯定其闪烁的解决方案......但有不利点,因为我的节目转身-200%的速度更慢,我的意思是节目变成awesomelly更慢的像5233倍缓慢,不使用override子的是一个好主意。

I've tested the "flickering solution" in all my applications and yes its a flickering solution... but has the negative point 'cause my programs turns around -200% speed more slow, I mean when using that override sub the programs turns awesomelly more slow like x6 times more slow so is not a good idea to use the override sub as is.

有人知道,如果我能避免闪烁,而不ralentize我的应用程序?

Someone knows if I can avoid the flickering without ralentize my application?

推荐答案

您重绘控制每一次,你还必须重新绘制背景;你的应用程序可能无法声称资源的操作来完成。您正在使用基本的解决方案,设置一个标志,表明你希望你的形式和一切它即将被双缓冲。你可以消耗资源的不必要的量与此有关。 相反,你可以设置双缓冲属性为true涉及图像调整大小,每个对象。 计算机具有有限的资源,你应该preserve尽可能多的。这就是为什么微软predefined这么多的参数和资源释放程序的原因。

Every time you redraw a control, You also have to redraw the background; an operation that your application might not have claimed resources to accomplish. The solution that you're using basically sets a flag to indicate that you want your form and everything it draws to be double buffered. You can consume an unnecessary amount of resources with this. Instead, you could set the double buffered property to true on each object that is involved in your image re-size. Computers have limited resources and you should preserve as many as possible. This is the reason why Microsoft predefined so many parameters and resource freeing procedures.

编辑:图片框默认情况下,双缓冲处理OnPaint事件。你仍然需要在背景物体的双缓冲区。

PictureBox is double buffered by default to handle the onpaint event. You still require double buffer on the background objects.

这篇关于忽明忽暗&QUOT;的CreateParams&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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