Exemple #1
0
        /// <summary>
        /// Sets the progress bar according to current, min and max, without changing it's minimum and maximum values.
        /// </summary>
        /// <param name="This">This ProgressBar.</param>
        /// <param name="current">The current value.</param>
        /// <param name="min">The minimum value to assume.</param>
        /// <param name="max">The maximum value to assume.</param>
        public static void SetValue(this ProgressBar This, double current, double min, double max)
        {
            Contract.Requires(This != null);
            var newMax = max - min;

            This.SetPercent(newMax == 0 ? 0 : ((current - min) / newMax) * 100);
        }
Exemple #2
0
 /// <summary>
 /// Sets the progress bar according to current and max, without changing it's minimum and maximum values.
 /// </summary>
 /// <param name="This">This ProgressBar.</param>
 /// <param name="current">The current value.</param>
 /// <param name="max">The maximum value to assume.</param>
 public static void SetValue(this ProgressBar This, double current, double max)
 {
     Contract.Requires(This != null);
     This.SetPercent(max == 0 ? 0 : (current / max * 100));
 }