C# Progress Bar coding exception

I was looking to add a percentage to my progress bar and was sent this link:

All is fine with the code below with the exception of

            e.Graphics.TextRenderingHint =

I get the message "The name 'TextRenderingHint' does not exist in the current context  

How do I correct this?


        private void pictureBox1_Paint(object sender, PaintEventArgs e)
            // Clear the background.

            // Draw the progress bar.
            float fraction =
                (float)(ProgressValue - ProgressMinimum) /
                (ProgressMaximum - ProgressMinimum);
            int wid = (int)(fraction * pictureBox1.ClientSize.Width);
                Brushes.LightGreen, 0, 0, wid,

            // Draw the text.
            e.Graphics.TextRenderingHint =
            using (StringFormat sf = new StringFormat())
                sf.Alignment = StringAlignment.Center;
                sf.LineAlignment = StringAlignment.Center;
                int percent = (int)(fraction * 100);
                    percent.ToString() + "%",
                    this.Font, Brushes.Black,
                    pictureBox1.ClientRectangle, sf);
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
I commented out that line and it didn't seem to affect the program

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AndyAinscowFreelance programmer / ConsultantCommented:
That is a member of the System.Drawing namespace so try adding
using System.Drawing; at the top of the file that class is in
rwheeler23Author Commented:
System.Drawing was already there and I did comment it out and tested and it works so I will simply leave it out.
rwheeler23Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.