【发布时间】:2013-04-18 10:08:00
【问题描述】:
有没有办法在 C# 的进度条上写入默认文本?
这在 Form_Load 中不起作用,但在单击按钮时可以正常工作...
using (Graphics gr = progressBar1.CreateGraphics())
{
StringFormat sf = new StringFormat(StringFormatFlags.NoWrap);
sf.Alignment = StringAlignment.Center;
gr.DrawString("hello world",
new Font("Arial", 10.0f, FontStyle.Regular),
new SolidBrush(Color.Black),
progressBar1.ClientRectangle,
sf);
}
提前致谢
【问题讨论】:
-
我会尝试将
Label放在ProgressBar之上,然后将Label.Text与ProgressBar.Progress一起更新。我自己从来没有做过,所以我不能保证。
标签: c# progress-bar default drawstring form-load