C#
Hi My progressbar perecentage disappears when the progressbar updates why is this? CODE:
public void PBPercentage() { int percent = (int)(((double)(progressBar1.Value - progressBar1.Minimum) / (double)(progressBar1.Maximum - progressBar1.Minimum)) * 100); using (Graphics gr = progressBar1.CreateGraphics()) { gr.DrawString(percent.ToString() + "%", SystemFonts.DefaultFont, Brushes.Black, new PointF(progressBar1.Width / 2 - (gr.MeasureString(percent.ToString() + "%", SystemFonts.DefaultFont).Width / 2.0F), progressBar1.Height / 2 - (gr.MeasureString(percent.ToString() + "%", SystemFonts.DefaultFont).Height / 2.0F))); } }
VulpesRank #55 · 29.2K reputationPosted Mar 3, 2014, 12:57 PM EST
}
Shweta LodhaRank #31 · 39.8K reputationPosted Mar 3, 2014, 1:00 PM EST
After you Assign percentage text to progress bar, do
Application.DoEvents();