public void UpdateValue() { IEnumerator col = this.Panels.GetEnumerator(); while (col.MoveNext()) { StatusBarPanelEx c = (StatusBarPanelEx)col.Current; if (c.Style.ToString().EndsWith("ProgressBar")) { c.Value++; this.Invalidate(true); } } }
protected override void OnDrawItem(StatusBarDrawItemEventArgs e) { if (e.Panel.GetType().ToString().EndsWith("StatusBarPanelEx")) { StatusBarPanelEx ProgressPanel = (StatusBarPanelEx)e.Panel; //if this panel style!=ProgressBar? dont draw if (!(ProgressPanel.Style.ToString().EndsWith("ProgressBar"))) { return; } //draw if progress bar if (ProgressPanel.Value > ProgressPanel.Minimum) { int NewWidth = (int)(((double)ProgressPanel.Value / (double)ProgressPanel.Maximum) * (double)ProgressPanel.Width); Rectangle NewBounds = e.Bounds; //select brush type Brush PaintBrush; if (ProgressPanel.Style == StatusBarPanelStyleEx.SmoothProgressBar) { PaintBrush = new SolidBrush(ProgressPanel.ForeColor); } else { PaintBrush = new HatchBrush(ProgressPanel.HatchedProgressBarStyle, ProgressPanel.ForeColor, this.Parent.BackColor); } NewBounds.Width = NewWidth; e.Graphics.FillRegion(PaintBrush, new Region(NewBounds)); PaintBrush.Dispose(); } else { base.OnDrawItem(e); } } else { base.OnDrawItem(e); } }
public void UpdateValue(StatusBarPanelEx panel) { panel.Value++; this.Invalidate(true); }
public void UpdateValue(StatusBarPanelEx panel, int NewValue) { panel.Value = NewValue; this.Invalidate(true); }