ProgressStatusBar源代码(转自C#)
点击次数:19 次 发布日期:2008-11-26 23:57:35 作者:源代码网
|
源代码网推荐 測試過,挺好的! 源代码网推荐 源代码网推荐 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; 源代码网推荐 } 源代码网推荐 源代码网推荐 public int Minimum 源代码网推荐 { 源代码网推荐 get { return m_Minimum; } 源代码网推荐 set { m_Minimum = value; } 源代码网推荐 } 源代码网推荐 源代码网推荐 public int Maximum 源代码网推荐 { 源代码网推荐 get { return m_Maximum; } 源代码网推荐 set { m_Maximum = value; } 源代码网推荐 } 源代码网推荐 源代码网推荐 public int Value 源代码网推荐 { 源代码网推荐 get { return m_Value; } 源代码网推荐 set { m_Value = value; } 源代码网推荐 } 源代码网推荐 源代码网推荐 public Color ForeColor 源代码网推荐 { 源代码网推荐 get { return m_Color; } 源代码网推荐 set { m_Color = value; } 源代码网推荐 } 源代码网推荐 } 源代码网推荐 源代码网推荐 源代码网推荐 源代码网推荐 源代码网供稿. |
