摘自:http://discuss.develop.com/
測試過,挺好的!
public class ProgressStatusBar : System.Windows.Forms.StatusBar
{
public ProgressStatusBar()
{
this.SizingGrip = false;
this.ShowPanels = true;
}
protected override void
OnDrawItem(StatusBarDrawItemEventArgs e)
{
if
(e.Panel.GetType().ToString().EndsWith("ProgressPanel"))
{
ProgressPanel ProgressPanel =
(ProgressPanel) e.Panel;
if (ProgressPanel.Value >
ProgressPanel.Minimum)
{
int NewWidth =
(int)(((double)ProgressPanel.Value / (double)ProgressPanel.Maximum) *
(double)ProgressPanel.Width);
Rectangle NewBounds = e.Bounds;
SolidBrush PaintBrush = new
SolidBrush(ProgressPanel.ForeColor);
NewBounds.Width = NewWidth;
e.Graphics.FillRegion(PaintBrush, new Region(NewBounds));
PaintBrush.Dispose();
}
else
{
base.OnDrawItem(e);
}
}
else
{
base.OnDrawItem(e);
}
}
public void UpdateValue(ProgressPanel ProgressPanel, int
NewValue)
{
ProgressPanel.Value = NewValue;
}
}
public class ProgressPanel : System.Windows.Forms.StatusBarPanel
{
private int m_Minimum = 1;
private int m_Maximum = 100;
private int m_Value = 0;
private Color m_Color;
public ProgressPanel()
{
this.Style = StatusBarPanelStyle.OwnerDraw;
this.ForeColor = Color.DarkBlue;
&打开: http://www.qqread.com/dotnet/c227905.html进入讨论组讨论。
相关图文阅读
频道图文推荐
健 康 咨 询
时 尚 咨 询
相关专题
- WPF的逻辑树和视觉树 (0次浏览)
- WPF的Attached属性 (0次浏览)
- WPF,将颠覆的设计世界? (0次浏览)
- Windows是否已经变成了一个怪物? (0次浏览)
- Windows2008用RODC保证分支机构安全 (0次浏览)
- Windows2008的NLB配置攻略 (0次浏览)
- Windows SharePoint Services 和 SharePoint P (0次浏览)
- Windows Forms中实现统一的数据验证(一) (0次浏览)
- Windows API一日一练:DrawText函数 (0次浏览)
- Win2008初次体验的几个心得 (0次浏览)



