本文整理汇总了C#中System.Windows.Forms.ProgressBar.CreateGraphics方法的典型用法代码示例。如果您正苦于以下问题:C# ProgressBar.CreateGraphics方法的具体用法?C# ProgressBar.CreateGraphics怎么用?C# ProgressBar.CreateGraphics使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ProgressBar
的用法示例。
在下文中一共展示了ProgressBar.CreateGraphics方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: writeProgess
internal void writeProgess(ProgressBar progressBar)
{
progressBar.Refresh();
using (Graphics gr = progressBar.CreateGraphics())
{
String s = progressBar.Value.ToString() + "/" + progressBar.Maximum.ToString();
gr.DrawString(s,
SystemFonts.DefaultFont,
Brushes.Black,
new PointF(progressBar.Width / 2 - (gr.MeasureString(s,
SystemFonts.DefaultFont).Width / 2.0F),
progressBar.Height / 2 - (gr.MeasureString(s,
SystemFonts.DefaultFont).Height / 2.0F)));
}
//progressBar.Refresh();
//progressBar.CreateGraphics().DrawString(progressBar.Value.ToString() + "/" + progressBar.Maximum.ToString(), new Font("Arial", (float)8.25, FontStyle.Regular), Brushes.Black, new PointF(progressBar.Width / 2 - 10, progressBar.Height / 2 - 7));
}
示例2: bUpdateOneSoCBar
private bool bUpdateOneSoCBar(ProgressBar prbrOneBar, int iPerc, char chState)
{
bool bRes=false;
prbrOneBar.Value=iPerc;
// compute forgeround color
prbrOneBar.ForeColor=clrGetColorFromChargePercent(iPerc);
// compute background color
// prbrOneBar.BackColor=Color.Gray;
prbrOneBar.BackColor=clrGetBgColorFromChargePercent(iPerc);
string strTempPerc=iPerc.ToString() + "%";
strTempPerc+=" " + chState;
Debug.WriteLine("Form1::bUpdateOneSoCBar() "+strTempPerc);
prbrOneBar.CreateGraphics().DrawString(strTempPerc, new Font("Arial", (float)8.25, FontStyle.Regular), Brushes.Black, new PointF(prbrOneBar.Width / 2 - 10, prbrOneBar.Height / 2 - 7));
return bRes;
}
示例3: ResetProgressBarHavePercent
public static void ResetProgressBarHavePercent(ProgressBar prgb, int Max, bool visi)
{
prgb.Step = 1;
prgb.Visible = visi;
prgb.Maximum = Max;
prgb.Minimum = 0;
int percent = (int)(((double)prgb.Value / (double)prgb.Maximum) * 100);
prgb.CreateGraphics().DrawString(percent.ToString() + "%", new Font("Arial", (float)8.25, FontStyle.Regular), Brushes.Black, new PointF(prgb.Width / 2 - 10, prgb.Height / 2 - 7));
prgb.Value = 0;
}