我有一个用 C# 编写的程序,它有一个窗口,其中包含一个带图像的 groupBox。
我有一个按钮可以做一些事情(具体做什么并不重要),它会在他的循环中刷新窗口(在 button_click 函数中)(使用 this.Refresh();)。
有没有一种方法可以在不刷新 groupBox 的情况下刷新窗口?
*我有另一个问题,我无法在 button_click 功能工作时最小化窗口。有什么办法可以解决吗?
最佳答案
使用Invalidate()而不是 Refresh()
this.Invalidate(false);//false to not redraw the controls in the form.
编辑: msdn
Calling the Invalidate method does not force a synchronous paint; to force a synchronous paint, call the Update method after calling the Invalidate method
所以:
this.Invalidate(false);
this.Update();
关于c# - 如何在不刷新 C# 窗口图像的情况下刷新窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6714501/