本文整理匯總了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;
}