C#Progress Bar标签显示完成百分比在运行时不可见 [英] C# Progress Bar lable to show percentage completion is not visible at runtime

查看:115
本文介绍了C#Progress Bar标签显示完成百分比在运行时不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在更新标签时出现问题,我正在使用它来显示进度条中的百分比完成情况。我正在使用后台工作程序来实现此目的。当我运行应用程序时,我能够看到进度条正确更新,而我用来显示完成百分比的标签是不可见的



以下是代码

I have a problem in updating the Label which i am using to show the Percentage completion in progress bar.I am using background worker to achieve this. When i run the application i am able to see the progress bar updating correctly whereas the label which i have used to show the percentage completion is not visible

Following are the codes

public int m_CurrentTestcase;
 

public void IncrementProgress()
{
m_CurrentTestcase++;
UpdateDetails();
}
 

private void UpdateDetails()
{
prgbarStatus.Value = m_CurrentTestcase;
this.Text = m_CurrentTestcase.ToString() + "of" + m_MaxTestcases.ToString() + "Testcases Completed";
 
}

推荐答案

引用:

this.Text = m_CurrentTestcase.ToString()+of+ m_MaxTestcases.ToString()+Testcases Completed;

this.Text = m_CurrentTestcase.ToString() + "of" + m_MaxTestcases.ToString() + "Testcases Completed";



我想你必须使用标签名称,而不是上面一行中的这个

另外请务必阅读如何:对Windows窗体控件进行线程安全调用 [ ^ ]。


这篇关于C#Progress Bar标签显示完成百分比在运行时不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆