void InitializeNetworkProgressBar() { NetworkProgressBar = new FlatProgressBar(); NetworkProgressBar.Dock = DockStyle.Top; NetworkProgressBar.Height = 3; NetworkProgressBar.ProgressColor = ControlPaint.Dark(Color.SlateGray, 0.15f); }
protected override void Dispose(bool disposing) { if (disposing) { if (foreground == null && progress != null) { progress.Dispose(); progress = null; } } base.Dispose(disposing); }
public formProgressOverlay(formProgressOverlay background) { SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.Opacity = 0.95; this.TransparencyKey = this.BackColor = Color.Magenta; this.ShowInTaskbar = false; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.StartPosition = FormStartPosition.Manual; progress = new FlatProgressBar() { Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top, Bounds = this.ClientRectangle, ForeColor = Color.LimeGreen, Animated = true, }; this.Controls.Add(progress); }
private void FlatButton_Click(object sender, EventArgs e) { if (!_progressOngoing) { var sleepAmount = ProgressCheckBox.Checked ? 30 : 10; _progressOngoing = true; FlatProgressBar.Value = 0; new Thread(() => { while (FlatProgressBar.Value < FlatProgressBar.Maximum) { Thread.Sleep(sleepAmount); Invoke((MethodInvoker)(() => FlatProgressBar.Increment(1))); } _progressOngoing = false; }).Start(); } }
public formProgressOverlay() { SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.Opaque, true); this.Opacity = 0.75; this.BackColor = Color.Black; this.ShowInTaskbar = false; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.StartPosition = FormStartPosition.Manual; this.Paint += background_Paint; foreground = new formProgressOverlay(this); foreground.Owner = this; progress = foreground.progress; this.MinimumSizeChanged += background_MinimumSizeChanged; this.MaximumSizeChanged += background_MaximumSizeChanged; this.Size = new Size(200, 7); }
public void Increment(int Amount) { FlatProgressBar value = this; value.Value = value.Value + Amount; }