public static void SetMax(this ProgressBar ctrl, int value) { if (ctrl.InvokeRequired) { SetMaxCallback d = new SetMaxCallback(SetMax); ctrl.FindForm().Invoke(d, new object[] { ctrl, value }); } else { ctrl.Maximum = value; } }
/// <summary> /// Sets the maximum value. If the maximum is less than or equal to 0, then the /// progress animation will become marquee. /// </summary> /// <param name="max">The max.</param> public static void SetMax(int max) { if (instance.InvokeRequired) //if another thread called this method { SetMaxCallback s = new SetMaxCallback(SetMax); instance.Invoke(s, max); } else { instance.progressBar.Maximum = (max < 0) ? 0 : max; if (max <= 0) { instance.progressBar.Style = ProgressBarStyle.Marquee; } } }
/// <summary> /// Sets the maximum value. If the maximum is less than or equal to 0, then the /// progress animation will become marquee. /// </summary> /// <param name="max">The max.</param> public static void SetMax(int max) { if (instance.InvokeRequired) //if another thread called this method { SetMaxCallback s = new SetMaxCallback(SetMax); instance.Invoke(s, max); } else { instance.progressBar.Maximum = (max < 0) ? 0 : max; if (max <= 0) instance.progressBar.Style = ProgressBarStyle.Marquee; } }
private void SetMax(int value) { if (this.TestProgressBar.InvokeRequired) { SetMaxCallback c = new SetMaxCallback(SetMax); this.Invoke(c, new object[] { value }); } else { this.TestProgressBar.Maximum = value; } }