0nPaint问题 [英] 0nPaint Problem

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

问题描述

你好,
我不知道C#很好.因此,您可能在这里找到一个虚拟问题.我目前编写了一个运行良好的应用.现在,此应用程序使用的数据变得非常大,我指出picturebox_paint每秒钟被调用一次!这占用了99%的CPU时间.
图片框包含在标签页中,唯一附加的方法是
pictureBox1_MouseDown.当用户选择其他标签页时,一切正常,CPU时间少于1秒.
有人可以给我建议吗?这正常吗?
预先感谢您的帮助.
Nicolas

Hello,
I don''t know c# very good. So it is possible that you find here a dummy question. I wrote a app that work fine, at this time. Now that the data this app use becomes very big, I remark that the picturebox_paint is called every second ! This take 99% of cpu time.
The picturebox is included in a tabpage and the only attached method is
pictureBox1_MouseDown. When user select an other tabpage, all things becomes ok and cpu time is less than 1 second.
Could anyone give me advice for this ? Is this normal ?
Thanks in advance for your help.
Nicolas

推荐答案

写道:​​

现在,此应用程序使用的数据变得非常大,我评论说picturebox_paint每秒钟被调用一次!

Now that the data this app use becomes very big, I remark that the picturebox_paint is called every second !



多久一次,取决于您.




How often it''s called, is up to you.


写道:​​

有人可以给我建议吗?这正常吗?

Could anyone give me advice for this ? Is this normal ?



一遍又一遍地调用图片框的唯一原因是,如果您继续对其调用Invalidate.当然,如果您正在编写自己的绘画方法,则画框有点过大,因为除了定义边框之外,它根本不做任何事情,但这不会使它更频繁地绘画.如果您发布代码,我们也许可以发表评论.除非您一直单击鼠标,否则鼠标按下事件仅被调用一次.



The only reason for your picture box to be called over and over, is if you keep calling Invalidate on it. Of course, if you''re writing your own paint method, a picture box is kind of overkill, because it''s not doing anything at all, apart from defining a border, but that wouldn''t make it paint more often. If you post your code, we can perhaps comment. The mouse down event is only called once, unless you keep clicking the mouse.


这篇关于0nPaint问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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