public static void Monitor0()
{
bool ToMineOrNot = Backend.ToMineOrNot;
while (ToMineOrNot)
{
Form1 temp = new Form1();
Form1.NonStaticDelegate = new Action(temp.setHashRate);
Form1.NonStaticDelegate();
Backend.hps = 0;
Thread.Sleep(1000);
}
if (ToMineOrNot == false)
{
}
}
public void setHashRate()
{
hashrate.Text = Backend.hps.ToString();
}
我必须获取静态虚空才能调用非静态虚空,我必须具有Monitor0静态,因为它必须在线程中运行,并且setHashRate()必须是非静态的才能编辑标签(这是一个Windows表单):
Thread thread = new Thread(Monitor0);
thread.Start();
有人知道我该怎么做吗?我不能这样做,因为标签不会更改:
Form1 form = new Form();
form.label1.Text = "text"