在撕裂我的动画上的WinForms C# [英] Tearing in my animation on WinForms C#

查看:179
本文介绍了在撕裂我的动画上的WinForms C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的库中,使我以动画的WinForm元素(下面的链接)的运动,当我用它来移动在窗体的透明面板(其中有一张照片背景)存在撕裂的数额特别巨大。

I am using a library in which enables me to animate movement of WinForm elements (linked below), when I use it to move a transparent panel across the form (which has a picture background) there is an extraordinary amount of tearing.

我认为解决方法是获得的WinForms以30fps的的速度刷新而不laggy。我想设置一个计时器做 This.Refresh(); 在30次,但它只是结束了加载速度慢。所以,我将如何实现形式的一个很好的刷新率?

I believe the fix is to get winforms to refresh at a rate of 30fps without being laggy. I tried settings a timer to do This.Refresh(); at 30 times a second but it just ended up with slow loading. So how would I achieve a nice refresh rate of the form?

上述的链接是在这里 - > <一个href=\"http://$c$c.google.com/p/dot-net-transitions/wiki/CodingWithTransitions#Creating_a_transition_that_works_on_a_single_property\" rel=\"nofollow\">http://$c$c.google.com/p/dot-net-transitions/wiki/CodingWithTransitions#Creating_a_transition_that_works_on_a_single_property

The link described above is here -> http://code.google.com/p/dot-net-transitions/wiki/CodingWithTransitions#Creating_a_transition_that_works_on_a_single_property

下面是撕裂的一个例子。它可能有一些做与面板的背景色设置为透明的事实
http://screencast.com/t/XIr3NkGI

Here is an example of the tearing. It might have something to do with the fact that the panel's backcolor is set to "transparent" http://screencast.com/t/XIr3NkGI

推荐答案

我这个年龄前使用时,我有一种形式闪烁与对照麻烦,我的情况有许多控制和加载窗体时控件会相当忽悠厉害。

I used this ages ago when I had trouble with controls on a form flickering, in my case there were many controls and when loading the form the controls would flicker quite badly.

在我用这个结尾:

    protected override CreateParams CreateParams
    {
        get
        {
            CreateParams cp = base.CreateParams;
            cp.ExStyle |= 0x02000000;
            return cp;
        }
    }

粘贴在窗体。

这会激活双缓冲在形式层面以及其中的所有控件。
然而,尽管我停止闪烁问题就大大降低了在该表格元素的似乎的移动,因为他们没有拿得出,直到他们是100%准备好速度。

It activates double buffering at the form level and for all controls within it. HOWEVER, while it stopped my flickering issue it greatly reduced the speed at which the forms elements seemed to move as they don't get drawn until they are 100% ready.

我想你可以试试,看看它是否适合你的情况。

I guess you can try and see if it suits your situation.

这篇关于在撕裂我的动画上的WinForms C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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