JonOfAllTrades said:
Perhaps I should have been more specific. "newToolTip" in my previous
example is a string, with a value in the format of "There are X items in the
queue, current state is Y." I do understand how to assign to a property, and
yes I've verified that the string has the expected value and is neither null
nor empty.
Hi Jon,
That is basically all you have to do. Once you set ToolTipText the
toolstripcontrol should display the tooltip. The code sample below should
display the current value whenever you move your mouse over the progressbar.
BackgroundWorker bw = new BackgroundWorker();
public Form1()
{
InitializeComponent();
bw.DoWork += new DoWorkEventHandler(bw_DoWork);
bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged);
bw.RunWorkerCompleted += new
RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
bw.WorkerReportsProgress = true;
}
void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
toolStripProgressBar1.Value = 0;
}
void bw_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
toolStripProgressBar1.Value = e.ProgressPercentage;
toolStripProgressBar1.ToolTipText =
"There are " + toolStripProgressBar1.Value + " out of "
+ toolStripProgressBar1.Maximum + " processed files";
}
void bw_DoWork(object sender, DoWorkEventArgs e)
{
for (int i = 0; i < 100; i++)
{
Thread.Sleep(100);
bw.ReportProgress(i);
}
}
protected override void OnLoad(EventArgs e)
{
bw.RunWorkerAsync();
}