Quantcast
Viewing all articles
Browse latest Browse all 12583

Graphics on ProgressBar shown only a few moment

Hi,

I'm trying to show a text on a ProgressBar.

I tried 2 ways:

progressBar1.CreateGraphics().DrawString(MyText, new Font("Segoe UI", (float)10, FontStyle.Bold), Brushes.Blue, new PointF(progressBar1.Width / 2 - 100, progressBar1.Height / 2 - 7));

using (Graphics gr = progressBar1.CreateGraphics())
{gr.DrawString(MyText, new Font("Segoe UI", (float)10, FontStyle.Bold), Brushes.Blue, new PointF(progressBar1.Width / 2 - 100, progressBar1.Height / 2 - 7));

but the result is always the same.

The text is shown only for a few moments and then dissapears.

I think it disappears during the OnPaint, is it possible ? Why it disappears ?


Viewing all articles
Browse latest Browse all 12583

Trending Articles