如何刷新图片框

发布于 2024-12-29 07:12:08 字数 148 浏览 0 评论 0原文

我没什么问题要问。

假设我在 pictureBox 上写了一个椭圆,然后单击了一个按钮。我希望 pictureBox 能够自行刷新。

我尝试过PictureBox.Invalidate(),但无法成功。 我最诚挚的问候...

I've little question to ask.

Let's say I've written an ellipse on pictureBox, then clicked a button. I want pictureBox to refresh itself.

I've tried PictureBox.Invalidate(), but could'nt made it.
My best regards...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

凉世弥音 2025-01-05 07:12:08

尝试方法 PictureBox.Refresh()(继承自Control)。

Try the method PictureBox.Refresh() (inherited from Control).

枫林﹌晚霞¤ 2025-01-05 07:12:08

您尝试过 PictureBox.Update(); 吗?或者尝试这样的http://msdn。 microsoft.com/en-us/library/system.windows.forms.picturebox.image.aspx

Have you tried PictureBox.Update(); ? Or try something like this http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.image.aspx

遗忘曾经 2025-01-05 07:12:08

有几种方法可以更新 PictureBox,如果有一些延迟,您使用的方法会有所不同。我有一个程序,可以在 PictureBox 中绘制键入的字符,并且击键处理很慢,因此当我快速键入时,它会滞后。

如果我 pictureBox.Refresh() ; 每次击键后,无论如何都会在处理击键后立即刷新图片。这样,当我快速打字时,我可以看到 PictureBox 试图赶上我,因为它绘制了每个字符。

如果我 pictureBox.Invalidate( );,那么也会刷新图片,但前提是系统有一些空闲时间。这样,当我快速打字时,当系统试图赶上时,我看不到任何事情发生,然后我输入的所有内容突然出现。

通常刷新会更好,但这里一篇文章描述了几种情况,其中Invalidate是更好的选择。

There are a couple ways to update the PictureBox, and the method you use makes a difference if you have some lag. I had a program that drew typed characters in a PictureBox, and the keystroke processing was slow so when I typed fast it would lag.

If I pictureBox.Refresh(); after each keystroke, then that refreshes the picture immediately after the keystroke is processed, no matter what. This way, when I typed fast I could see the PictureBox trying to catch up with me as it drew each character.

If instead I pictureBox.Invalidate();, then that refreshes the picture too, but only when the system has some free time. This way, when I typed fast I saw nothing happening while the system tried to catch up, and then everything I'd typed suddenly appeared.

Usually Refresh is better, but here's an article that describes a couple situations where Invalidate is the better choice.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文