示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JMLevelsSliderContainer"/> class.
        /// </summary>
        public JMLevelsSliderContainer()
        {
            this.enabled = true;

            this.median = 0.5f;

            this.size = new Size();

            this.minimumSlider = new JMLevelsSlider(Color.Black, 0, this)
            {
                MinimumValue = 0, MaximumValue = 253
            };
            this.minimumSlider.OnRefresh     += this.Refresh;
            this.minimumSlider.OnSliderMoved += this.MinimumSliderMoved;

            this.maximumSlider = new JMLevelsSlider(Color.White, 255, this)
            {
                MinimumValue = 2, MaximumValue = 255
            };
            this.maximumSlider.OnRefresh     += this.Refresh;
            this.maximumSlider.OnSliderMoved += this.MaximumSliderMoved;

            this.medianSlider = new JMLevelsSlider(Color.LightGray, 128, this)
            {
                MinimumValue = 1, MaximumValue = 254
            };
            this.medianSlider.OnRefresh     += this.Refresh;
            this.medianSlider.OnSliderMoved += this.MedianSliderMoved;

            this.sliders = new[] { this.minimumSlider, this.maximumSlider, this.medianSlider };
        }
示例#2
0
        /// <summary>
        /// Bring the specified slider to the front of the array
        /// </summary>
        /// <param name="slider">slider to move</param>
        public void BringToFront(JMLevelsSlider slider)
        {
            JMLevelsSlider[] levelsSliders = new JMLevelsSlider[this.sliders.Length];

            levelsSliders[0] = slider;

            int pos = 1;

            for (int x = 0; x < this.sliders.Length; x++)
            {
                if (this.sliders[x] != slider)
                {
                    levelsSliders[pos] = this.sliders[x];
                    pos++;
                }
            }

            this.sliders = levelsSliders;
        }