如何避免Form.Invalidate闪烁()? [英] How to avoid blinking in Form.Invalidate()?

查看:337
本文介绍了如何避免Form.Invalidate闪烁()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 f.Invalidate()来,因为它刷新重绘我的C#程序的图形,但是该图形闪烁。我还使用 e.Graphics.DrawImage()中的 f_Paint()方法。

I'm using f.Invalidate() to repaint graphics in my C# program but the graphic blinks as it refreshes. I'm also using e.Graphics.DrawImage() inside the f_Paint() method.

推荐答案

您需要设置 DoubleBuffered 为true。

You need to set DoubleBuffered to true.

由于它是一个受保护的财产,你需要让自己的控制:

Since it's a protected property, you'll need to make your own control:

class Canvas : Control {
    public Canvas() { DoubleBufferred = true; }
}

这篇关于如何避免Form.Invalidate闪烁()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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