随后的代码中存在问题。
我无法理解为什么WorkshopIsPainted
总是null
,尽管workshop.Painted
是true
或false
。
public partial class Form1 : Form
{
public bool? WorkshopIsPainted;
public Form1()
{
InitializeComponent();
}
private void timer4_Tick(object sender, EventArgs e)
{
if (!workshop.painted)
{
WorkshopIsPainted = workshop.Painted;
}
else return;
}
}
将代码更改为
private void timer4_Tick(object sender, EventArgs e)
{
WorkshopIsPainted = workshop.Painted;
return;
}