当RectangleShape调整大小时停止闪烁 [英] Stopping flickering when RectangleShape resizes

查看:75
本文介绍了当RectangleShape调整大小时停止闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我正在制作一个自定义进度条,其中有灰色背景(2),进度矩形(1)为蓝色。为了显示正在进行的进度,进度矩形的宽度增加(见图表)。



 _____________________ 
| | |
| 1 | - > 2 |
| ____________ | ________ |



问题是,即使使用以下代码,进度矩形也会闪烁:



  .SetStyle(ControlStyles.UserPaint, True 
Me .SetStyle(ControlStyles.AllPaintingInWmPaint, True
.SetStyle(ControlStyles.DoubleBuffer, True





进度矩形的宽度被编码为在间隔100ms的定时器上增加1到400.



请帮忙。我找不到任何其他答案,我不想创建一个flash动画。



-Rixterz

解决方案

这可能很有用:

SO:为什么我的WinForms控制闪烁并缓慢调整大小? [ ^ ]



你能告诉我们方法吗重写OnPaint()?


Dim g as graphics = me.creategraphics - > e.graphics ...

Hello,

I'm making a custom progressbar where there is a gray background (2) and the progress rectangle (1) is blue. To show progress being made, the progress rectangle increases in width (see diagram).

 _____________________
|            |        |
|     1      |--> 2   |
|____________|________|


The problem is that even with the following code, the progress rectangle flickers:

Me.SetStyle(ControlStyles.UserPaint, True)
Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
Me.SetStyle(ControlStyles.DoubleBuffer, True)



The progress rectangle's width is coded to increase by 1 up to 400 on a timer with the interval 100ms.

Please help. I can't find any other answers and I don't want to have to create a flash animation.

-Rixterz

解决方案

That could be useful:
SO: Why do my WinForms controls flicker and resize slowly?[^]

Could you show us the method overriding OnPaint()?


Dim g as graphics= me.creategraphics --> e.graphics...


这篇关于当RectangleShape调整大小时停止闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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