简体   繁体   English

C#:当窗体不集中时,如何重画窗体?

[英]C#: How do I repaint my form when it's not focused?

I want to repaint/invalidate/refresh my form so that it updates seamlessly when it's not focused. 我想重新绘制/无效/刷新我的表单,以便在不集中时可以无缝更新。 How can I achieve this? 我该如何实现? Right now it will only update itself when I give it focus or move my mouse over it etc. 现在,只有当我将焦点或鼠标移到其上时,它才会自我更新。

Edit: I tried using a timer that would call this.Invalidate(); 编辑:我尝试使用计时器,将调用this.Invalidate();。 every 25millisecond 每25毫秒

Maybe Invalidate(); 也许Invalidate(); is what you're looking for, it forces the particular control (Whether it be a form or menu etc.) to redraw itself on the next update. 是您要查找的内容,它将强制特定控件(无论是表单还是菜单等)在下一次更新时重新绘制自身。

I've never used it myself so i'm curious if it actually works. 我从未亲自使用过它,所以我很好奇它是否真的有效。

http://msdn.microsoft.com/en-us/library/598t492a.aspx http://msdn.microsoft.com/en-us/library/598t492a.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM