How to draw graphics onto a control
Posted: Sun Oct 16, 2011 5:18 am
Lets say for instance you have a webbrowser and you want the webbrowser url in the progressbar without using labels this is how you do it
Add a progressbar first of course
and then add a timer enable it and have it have an interval of 1
then double click it and put
Add a progressbar first of course
and then add a timer enable it and have it have an interval of 1
then double click it and put
Code: Select all
{
Font SFont = new Font("Courier New", 8);
SolidBrush SBrush = new SolidBrush(Color.Black);
Graphics g = progressBar1.CreateGraphics();
StringFormat SFormat = new StringFormat();
g.DrawString(Webbrowser1.url, SFont, SBrush, 5, 5, SFormat);
SFont.Dispose();
SBrush.Dispose();
g.Dispose();
}