Jake

Jake

  • NA
  • 1
  • 0

Text on Progress bar

Mar 24 2010 8:22 PM
I have several progress bars which I have placed and parented on a listview object which, well, track progress of several different events.
I wish to put the actual percentage of the task on top of the bar with text, but I can't find a good way to do it.
I have tried placing a label on top of it, but the background of it wont go clear even if I set the BackColor to Color.Transparent.
I have also tried using the progressbars CreateGraphics function with DrawString but that didnt work either.
[code]
gr.DrawString(pText, SystemFonts.DefaultFont, New PointF(progBar.Width / 2 - (gr.MeasureString(pText, SystemFonts.DefaultFont).Width / 2.0F), progBar.Height / 2 - (gr.MeasureString(pText, SystemFonts.DefaultFont).Height / 2.0F)))
gr.DrawString(pText, SystemFonts.DefaultFont, Brushes.Black, progBar.Left + progBar.Width / 2, progBar.Top + progBar.Height / 4)
progBar.CreateGraphics().DrawString(pText, New Font("Arial", 8.25, FontStyle.Regular), Brushes.Black, New PointF(progBar.Width / 2 - 10, progBar.Height / 2 - 7))
[/code]
None of these have worked for me. The progress bar appears, but no text