|
// StatusBarProgressPanel control
// 2005 Mark Harmon
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace WinCopy
{
public class StatusBarProgressPanel : StatusBarPanel
{
private bool isAdded = false;
private ProgressBar progressBar = new ProgressBar();
[Category("Progress")]
public ProgressBar ProgressBar
{
get { return progressBar; }
}
public StatusBarProgressPanel() : base()
{
// Just to be safe
this.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
}
public void ParentDrawItemHandler(object sender, StatusBarDrawItemEventArgs sbdevent)
{
// Only add this once to the parent's control container
if (isAdded == false)
{
this.Parent.Controls.Add(this.progressBar);
this.isAdded = true;
}
// Get the bounds of this panel and copy to the progress bar's bounds
if (sbdevent.Panel == this)
progressBar.Bounds = sbdevent.Bounds;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.