Example #1
0
        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);
                }
            }
        }
Example #2
0
        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);
            }
        }
Example #3
0
 public void UpdateValue(StatusBarPanelEx panel)
 {
     panel.Value++;
     this.Invalidate(true);
 }
Example #4
0
 public void UpdateValue(StatusBarPanelEx panel, int NewValue)
 {
     panel.Value = NewValue;
     this.Invalidate(true);
 }