0

在我们的项目中,我创建了一个表单并如下运行它:

 Application.run(myform);

在这种形式中,我们需要绘制一些东西,因此它的 OnPaint 方法被覆盖并且通常没有问题,但是当我们显示消息框或表单时永远不会调用 OnPaint:

 Messagebox.show("something");

或者

 formA.showDialog();

所以当用户拖动消息框时,会留下痕迹,因为背景不能重绘。有谁知道为什么以及如何解决这个问题?

4

1 回答 1

-1

您可以通过调用该Refresh方法使表单重新绘制。

var timer = new Timer();
timer.Interval = 1000;
timer.Tick += new EventHandler(timer_Tick);
timer.Start();

void timer_Tick(object sender, EventArgs e)
{
    Refresh();
}
于 2012-08-08T07:18:19.233 回答