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.
我尝试使用一个定时器来调用 this.Invalidate();每 25 毫秒
I tried using a timer that would call this.Invalidate(); every 25millisecond
推荐答案
也许 Invalidate();
是你要找的,它强制特定的控件(无论是表单还是菜单等)在下次更新时重绘.
Maybe 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
这篇关于C#:当表单未聚焦时如何重新绘制表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!