Exemple #1
0
        protected virtual void CorrectValues()
        {
            Values.BeginUpdate();
            try {
                for (int index = 0; index < Values.Count; index++)
                {
                    int minValue = index == 0 ? Properties.Minimum : Values[index - 1];
                    int maxValue = index == Values.Count - 1 ? Properties.Maximum : Values[index + 1];

                    minValue = Math.Min(Properties.Maximum, Math.Max(Properties.Minimum, minValue));
                    maxValue = Math.Min(Properties.Maximum, Math.Max(Properties.Minimum, maxValue));

                    Values[index] = Math.Max(minValue, Math.Min(maxValue, Values[index]));
                }
            }
            finally {
                Values.CancelUpdate();
            }
        }