如何在状态栏中调用进度条?

Sev*_*Sev 5 .net c# multithreading

我使用以下代码来调用我的应用程序中的主UI线程上的控件.我在Status Strip中的进度条没有InvokeRequired,我需要以某种方式调用System.Windows.Forms.ToolStripProgressBar.

if (txtbox1.InvokeRequired)
{
txtbox1.Invoke(new MethodInvoker(delegate { txtbox1.Text = string.Empty; }));
}
Run Code Online (Sandbox Code Playgroud)

Bal*_*a R 7

尝试

if (toolStripProgressBar1.Parent.InvokeRequired)
{
    toolStripProgressBar1.Parent.Invoke(new MethodInvoker(delegate { toolStripProgressBar1.Value= 100; }));
}
Run Code Online (Sandbox Code Playgroud)

  • 谢谢,但没有父母.相反,我做了这个prgBarMain.GetCurrentParent().InvokeRequired (4认同)
  • 父属性是.net 4.5的内部属性 (4认同)