Esempio n. 1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="TechColorPicker" /> class.
        /// </summary>
        /// <param name="component">
        ///     The component.
        /// </param>
        public TechColorPicker(MenuColor component)
            : base(component)
        {
            Hsl tempHsl;

            this.colorBox = new ColorBox(new Size(200, 200), true)
            {
                Hsl = Utilities.RgbToHsl(this.Component.Color.ToSystemColor())
            };

            this.verticalColorSlider = new VerticalColorSlider(new Size(40, 200), true)
            {
                CbHsl = Utilities.RgbToHsl(this.Component.Color.ToSystemColor())
            };
            this.verticalColorSlider.ColorSliderScroll += () =>
            {
                tempHsl           = this.colorBox.Hsl;
                tempHsl.H         = this.verticalColorSlider.CbHsl.H;
                this.colorBox.Hsl = tempHsl;
            };

            this.verticalAlphaSlider = new VerticalAlphaSlider(new Size(40, 200));
            tempHsl   = this.verticalAlphaSlider.CbHsl;
            tempHsl.L = this.colorBox.Hsl.L;
            this.verticalAlphaSlider.CbHsl              = tempHsl;
            this.verticalAlphaSlider.AlphaSliderScroll += () =>
            {
                tempHsl           = this.colorBox.Hsl;
                tempHsl.L         = this.verticalAlphaSlider.CbHsl.L;
                this.colorBox.Hsl = tempHsl;
            };
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="LightColorPicker" /> class.
        /// </summary>
        /// <param name="component">
        ///     The component.
        /// </param>
        public LightColorPicker2(MenuColor component)
            : base(component)
        {
            Hsl tempHsl;
            this.colorBox = new ColorBox(new Size(200, 200))
            { Hsl = Utilities.RgbToHsl(this.Component.Color.ToSystemColor()) };

            this.verticalColorSlider = new VerticalColorSlider(new Size(40, 200))
            { CbHsl = Utilities.RgbToHsl(this.Component.Color.ToSystemColor()) };
            this.verticalColorSlider.ColorSliderScroll += () =>
            {
                tempHsl = this.colorBox.Hsl;
                tempHsl.H = this.verticalColorSlider.CbHsl.H;
                this.colorBox.Hsl = tempHsl;
            };

            this.verticalAlphaSlider = new VerticalAlphaSlider(new Size(40, 200));
            tempHsl = this.verticalAlphaSlider.CbHsl;
            tempHsl.L = this.colorBox.Hsl.L;
            this.verticalAlphaSlider.CbHsl = tempHsl;
            this.verticalAlphaSlider.AlphaSliderScroll += () =>
            {
                tempHsl = this.colorBox.Hsl;
                tempHsl.L = this.verticalAlphaSlider.CbHsl.L;
                this.colorBox.Hsl = tempHsl;
            };
        }