public ColouringHSVMenu(Rectangle bounds, Colours colours, Color activeColour = default, Action <Color> onTryColourAction = null,
                                Action <Color> onFinalColourAction = null)
            : base(bounds, colours)
        {
            if (activeColour == default)
            {
                activeColour = Color.Black;
            }

            Int32 hue_slider_width = Convert.ToInt32(this.mBounds.Width * 0.15f);
            Int32 separator_width  = Convert.ToInt32(this.mBounds.Width * 0.075f);

            this.colourPicker = new ColourPicker(new Rectangle(this.mBounds.X + hue_slider_width + separator_width,
                                                               this.mBounds.Y,
                                                               this.mBounds.Width - hue_slider_width - separator_width,
                                                               this.mBounds.Height),
                                                 colours,
                                                 c => {
                this.colourPicker.mData.mHoverText = $"R: {c.R}, G: {c.G}, B: {c.B}{Environment.NewLine}#{c.R:X2}{c.G:X2}{c.B:X2}";
                onTryColourAction?.Invoke(c);
            },
                                                 onFinalColourAction);
            this.hueSlider = new HueSlider(new Rectangle(this.mBounds.X, this.mBounds.Y, hue_slider_width, this.mBounds.Height),
                                           this.colourPicker.SetHueColour,
                                           this.colourPicker.SetHueColour);

            this.separatorBounds = new Rectangle(this.hueSlider.mBounds.Right, this.mBounds.Y - 4, separator_width, this.mBounds.Height + 8);

            this.SetColour(activeColour, false);
            this.mComponents.AddRange(new ICustomComponent[] { this.hueSlider, this.colourPicker });
        }
Example #2
0
        void ReleaseDesignerOutlets()
        {
            if (GoBackButton != null)
            {
                GoBackButton.Dispose();
                GoBackButton = null;
            }

            if (AdjustBrightnessCheckbox != null)
            {
                AdjustBrightnessCheckbox.Dispose();
                AdjustBrightnessCheckbox = null;
            }

            if (AdjustHueCheckbox != null)
            {
                AdjustHueCheckbox.Dispose();
                AdjustHueCheckbox = null;
            }

            if (AdjustOpacityCheckbox != null)
            {
                AdjustOpacityCheckbox.Dispose();
                AdjustOpacityCheckbox = null;
            }

            if (AdjustSaturationCheckbox != null)
            {
                AdjustSaturationCheckbox.Dispose();
                AdjustSaturationCheckbox = null;
            }

            if (BaseColorSelector != null)
            {
                BaseColorSelector.Dispose();
                BaseColorSelector = null;
            }

            if (BrightnessSlider != null)
            {
                BrightnessSlider.Dispose();
                BrightnessSlider = null;
            }

            if (BrightnessValue != null)
            {
                BrightnessValue.Dispose();
                BrightnessValue = null;
            }

            if (Color != null)
            {
                Color.Dispose();
                Color = null;
            }

            if (ColorName != null)
            {
                ColorName.Dispose();
                ColorName = null;
            }

            if (HueSlider != null)
            {
                HueSlider.Dispose();
                HueSlider = null;
            }

            if (HueValue != null)
            {
                HueValue.Dispose();
                HueValue = null;
            }

            if (OpacitySlider != null)
            {
                OpacitySlider.Dispose();
                OpacitySlider = null;
            }

            if (OpacityValue != null)
            {
                OpacityValue.Dispose();
                OpacityValue = null;
            }

            if (SaturationSlider != null)
            {
                SaturationSlider.Dispose();
                SaturationSlider = null;
            }

            if (SaturationValue != null)
            {
                SaturationValue.Dispose();
                SaturationValue = null;
            }
        }