什么是调用?

什么是方法调用,control.invoke?

在编程中一般调用什么

例子 :

MethodInvoker getValues = new MethodInvoker(delegate() { checkbox1Checked = checkbox1.Checked; textBox6Text = textBox6.Text; textBox7Text = textBox7.Text; textBox3Text = textBox3.Text; textBox1Text = textBox1.Text; textBox4Text = textBox4.Text; richTextBox1Text = richTextBox1.Text; textBox5Text = textBox5.Text; }); if (this.InvokeRequired) { this.Invoke(getValues); } else { getValues(); } 

而且我也想知道MethodInvoker和InvokeRequired是什么意思?

“调用”是指调用方法。

在winforms中, Control.Invoke用于调用UI线程上的方法 – 如果没有它,您可以通过从另一个线程更新UI来导致exception。

因此,如果InvokeRequires返回true则意味着您没有在UI线程中运行,并且应该使用Control.Invoke在正确的线程中运行调用。