Пример #1
0
        public ColorPalette( )
        {
            this.hsbColor     = new HuiruiSoft.Drawing.HSBCOLOR( );
            this.hsbColor.Hue = this.hsbColor.Saturation = this.hsbColor.Brightness = 1.0;
            this.labColor     = new HuiruiSoft.Drawing.CIELabColor( );
            this.labColor.L   = this.labColor.A = this.labColor.B = 0;

            this.cubeZAxes    = HuiruiSoft.Drawing.ColorCubeZAxes.Hue;
            this.currentColor = HuiruiSoft.Drawing.ColorTranslator.HSBToRGB(this.hsbColor);

            this.InitializeComponent( );

            base.TabStop = true;
            this.Cursor  = System.Windows.Forms.Cursors.Cross;

            base.SetStyle(
                ControlStyles.UserPaint |
                ControlStyles.UserMouse |
                ControlStyles.Selectable |
                ControlStyles.ResizeRedraw |
                ControlStyles.DoubleBuffer |
                ControlStyles.StandardClick |
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.StandardDoubleClick, true);
        }
Пример #2
0
        public ColorSlider( )
        {
            this.cubeZaxes   = HuiruiSoft.Drawing.ColorCubeZAxes.Hue;
            this.orientation = Orientation.Vertical;

            this.hsbColor            = new HuiruiSoft.Drawing.HSBCOLOR( );
            this.hsbColor.Hue        = 360.0;
            this.hsbColor.Saturation = 1.0;
            this.hsbColor.Brightness = 1.0;
            this.cubeZaxes           = HuiruiSoft.Drawing.ColorCubeZAxes.Hue;
            this.cieLabColor         = new HuiruiSoft.Drawing.CIELabColor( );
            this.currentColor        = HuiruiSoft.Drawing.ColorTranslator.HSBToRGB(this.hsbColor);

            base.TabStop = true;

            base.SetStyle(
                ControlStyles.UserPaint |
                ControlStyles.UserMouse |
                ControlStyles.Selectable |
                ControlStyles.ResizeRedraw |
                ControlStyles.DoubleBuffer |
                ControlStyles.StandardClick |
                ControlStyles.StandardDoubleClick |
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.SupportsTransparentBackColor, true);
        }
Пример #3
0
        private HuiruiSoft.Drawing.HSBCOLOR GetColor(int markerPositionX, int markerPositionY)
        {
            double tmpXcoordinate = (double)markerPositionX;
            double tmpYcoordinate = (double)markerPositionY;
            double tmpBoundWidth  = (double)(this.Width - 2 * BorderSize);
            double tmpBoundHeight = (double)(this.Height - 2 * BorderSize);

            var tmpHslColor = new HuiruiSoft.Drawing.HSBCOLOR( );

            switch (this.cubeZAxes)
            {
            case HuiruiSoft.Drawing.ColorCubeZAxes.Hue:
                tmpHslColor.Hue        = this.hsbColor.Hue;
                tmpHslColor.Saturation = tmpXcoordinate / tmpBoundWidth;
                tmpHslColor.Brightness = 1.0 - tmpYcoordinate / tmpBoundHeight;
                break;

            case HuiruiSoft.Drawing.ColorCubeZAxes.Saturation:
                tmpHslColor.Saturation = this.hsbColor.Saturation;
                tmpHslColor.Hue        = tmpXcoordinate / tmpBoundWidth;
                tmpHslColor.Brightness = 1.0 - tmpYcoordinate / tmpBoundHeight;
                break;

            case HuiruiSoft.Drawing.ColorCubeZAxes.Brightness:
                tmpHslColor.Brightness = this.hsbColor.Brightness;
                tmpHslColor.Hue        = tmpXcoordinate / tmpBoundWidth;
                tmpHslColor.Saturation = 1.0 - tmpYcoordinate / tmpBoundHeight;
                break;

            case HuiruiSoft.Drawing.ColorCubeZAxes.Red:
            case HuiruiSoft.Drawing.ColorCubeZAxes.Green:
            case HuiruiSoft.Drawing.ColorCubeZAxes.Blue:
                int tmpColorX = this.Round(255 * tmpXcoordinate / tmpXcoordinate);
                int tmpColorY = this.Round(255 * (1.0 - tmpYcoordinate / tmpBoundHeight));

                if (tmpColorX < 000)
                {
                    tmpColorX = 0;
                }
                if (tmpColorY < 000)
                {
                    tmpColorY = 0;
                }
                if (tmpColorX > 255)
                {
                    tmpColorX = 255;
                }
                if (tmpColorY > 255)
                {
                    tmpColorY = 255;
                }

                switch (this.cubeZAxes)
                {
                case HuiruiSoft.Drawing.ColorCubeZAxes.Red:
                    tmpHslColor = HuiruiSoft.Drawing.ColorTranslator.RGBToHSB(System.Drawing.Color.FromArgb(this.currentColor.R, tmpColorY, tmpColorX));
                    break;

                case HuiruiSoft.Drawing.ColorCubeZAxes.Green:
                    tmpHslColor = HuiruiSoft.Drawing.ColorTranslator.RGBToHSB(System.Drawing.Color.FromArgb(tmpColorY, this.currentColor.G, tmpColorX));
                    break;

                case HuiruiSoft.Drawing.ColorCubeZAxes.Blue:
                    tmpHslColor = HuiruiSoft.Drawing.ColorTranslator.RGBToHSB(System.Drawing.Color.FromArgb(tmpColorX, tmpColorY, this.currentColor.B));
                    break;
                }
                break;

            case HuiruiSoft.Drawing.ColorCubeZAxes.Luminance:
            case HuiruiSoft.Drawing.ColorCubeZAxes.A:
            case HuiruiSoft.Drawing.ColorCubeZAxes.B:
                HuiruiSoft.Drawing.CIELabColor tmpLabColor = new HuiruiSoft.Drawing.CIELabColor( );

                switch (this.cubeZAxes)
                {
                case HuiruiSoft.Drawing.ColorCubeZAxes.Luminance:
                    tmpLabColor.L = this.labColor.L;
                    tmpLabColor.A = this.Round((double)255 * tmpXcoordinate / tmpBoundWidth - 128);
                    tmpLabColor.B = this.Round(127 - (double)255 * tmpYcoordinate / tmpBoundHeight);
                    break;

                case HuiruiSoft.Drawing.ColorCubeZAxes.A:
                    tmpLabColor.L = this.Round(tmpYcoordinate * 255 / tmpBoundHeight);
                    tmpLabColor.A = this.labColor.A;
                    tmpLabColor.B = this.Round((double)255 * tmpXcoordinate / tmpBoundWidth - 128);
                    break;

                case HuiruiSoft.Drawing.ColorCubeZAxes.B:
                    tmpLabColor.L = this.Round(tmpYcoordinate * 255 / tmpBoundHeight);
                    tmpLabColor.A = this.Round((double)255 * tmpXcoordinate / tmpBoundWidth - 128);
                    tmpLabColor.B = this.labColor.B;
                    break;
                }
                tmpHslColor = HuiruiSoft.Drawing.ColorTranslator.RGBToHSB(HuiruiSoft.Drawing.ColorTranslator.CIELabToColor(tmpLabColor));

                break;
            }

            return(tmpHslColor);
        }
Пример #4
0
        private void DrawColorMapContent( )
        {
            if (this.colorPaletteMap != null)
            {
                System.Drawing.Rectangle tmpFillBounds, tmpLinearBounds;
                System.Drawing.Drawing2D.LinearGradientBrush tmpGradientBrush;

                int tmpBoundWidth = this.Width - 2 * BorderSize, tmpBoundHeight = this.Height - 2 * BorderSize;

                using (var tmpImageGraphics = System.Drawing.Graphics.FromImage(this.colorPaletteMap))
                {
                    switch (this.cubeZAxes)
                    {
                    case HuiruiSoft.Drawing.ColorCubeZAxes.Red:
                    case HuiruiSoft.Drawing.ColorCubeZAxes.Green:
                    case HuiruiSoft.Drawing.ColorCubeZAxes.Blue:
                        int tmpRGBColorR, tmpRGBColorG, tmpRGBColorB;
                        tmpFillBounds    = tmpLinearBounds = new System.Drawing.Rectangle(BorderSize, BorderSize, tmpBoundWidth, 1);
                        tmpGradientBrush = new System.Drawing.Drawing2D.LinearGradientBrush(tmpLinearBounds, this.currentColor, this.currentColor, 0, false);

                        switch (this.cubeZAxes)
                        {
                        case HuiruiSoft.Drawing.ColorCubeZAxes.Red:
                            tmpRGBColorR = this.currentColor.R;
                            for (int index = 0; index < tmpBoundHeight; index++)
                            {
                                tmpFillBounds.Y = index + BorderSize;
                                tmpRGBColorG    = this.Round(255 - (255 * (double)index / tmpBoundHeight));

                                tmpGradientBrush.LinearColors = new System.Drawing.Color[] { System.Drawing.Color.FromArgb(tmpRGBColorR, tmpRGBColorG, 0), System.Drawing.Color.FromArgb(tmpRGBColorR, tmpRGBColorG, 255) };
                                tmpImageGraphics.FillRectangle(tmpGradientBrush, tmpFillBounds);
                            }
                            break;

                        case HuiruiSoft.Drawing.ColorCubeZAxes.Green:
                            tmpRGBColorG = this.currentColor.G;
                            for (int index = 0; index < tmpBoundHeight; index++)
                            {
                                tmpFillBounds.Y = index + BorderSize;
                                tmpRGBColorR    = this.Round(255 - (255 * (double)index / tmpBoundHeight));

                                tmpGradientBrush.LinearColors = new System.Drawing.Color[] { System.Drawing.Color.FromArgb(tmpRGBColorR, tmpRGBColorG, 0), System.Drawing.Color.FromArgb(tmpRGBColorR, tmpRGBColorG, 255) };
                                tmpImageGraphics.FillRectangle(tmpGradientBrush, tmpFillBounds);
                            }
                            break;

                        case HuiruiSoft.Drawing.ColorCubeZAxes.Blue:
                            tmpRGBColorB = this.currentColor.B;
                            for (int index = 0; index < tmpBoundHeight; index++)
                            {
                                tmpFillBounds.Y = index + BorderSize;
                                tmpRGBColorG    = this.Round(255 - (255 * (double)index / tmpBoundHeight));

                                tmpGradientBrush.LinearColors = new System.Drawing.Color[] { System.Drawing.Color.FromArgb(0, tmpRGBColorG, tmpRGBColorB), System.Drawing.Color.FromArgb(255, tmpRGBColorG, tmpRGBColorB) };
                                tmpImageGraphics.FillRectangle(tmpGradientBrush, tmpFillBounds);
                            }
                            break;
                        }
                        break;

                    case HuiruiSoft.Drawing.ColorCubeZAxes.Hue:
                    case HuiruiSoft.Drawing.ColorCubeZAxes.Brightness:
                    case HuiruiSoft.Drawing.ColorCubeZAxes.Saturation:
                        var tmpHslStart = new HuiruiSoft.Drawing.HSBCOLOR( );
                        var tmpHslEnd   = new HuiruiSoft.Drawing.HSBCOLOR( );
                        tmpFillBounds    = tmpLinearBounds = new System.Drawing.Rectangle(BorderSize, BorderSize, tmpBoundWidth, 1);
                        tmpGradientBrush = new System.Drawing.Drawing2D.LinearGradientBrush(tmpLinearBounds, this.currentColor, this.currentColor, 0, false);

                        switch (this.cubeZAxes)
                        {
                        case HuiruiSoft.Drawing.ColorCubeZAxes.Hue:
                            tmpHslStart.Hue        = tmpHslEnd.Hue = this.hsbColor.Hue;
                            tmpHslStart.Saturation = 0.0;
                            tmpHslEnd.Saturation   = 1.0;

                            for (int index = 0; index < tmpBoundHeight; index++)
                            {
                                tmpFillBounds.Y        = index + BorderSize;
                                tmpHslStart.Brightness = tmpHslEnd.Brightness = 1.0 - (double)index / tmpBoundHeight;

                                tmpGradientBrush.LinearColors = new System.Drawing.Color[] { HuiruiSoft.Drawing.ColorTranslator.HSBToRGB(tmpHslStart), HuiruiSoft.Drawing.ColorTranslator.HSBToRGB(tmpHslEnd) };
                                tmpImageGraphics.FillRectangle(tmpGradientBrush, tmpFillBounds);
                            }
                            break;

                        case HuiruiSoft.Drawing.ColorCubeZAxes.Saturation:
                            tmpHslStart.Saturation = tmpHslEnd.Saturation = this.hsbColor.Saturation;
                            tmpHslStart.Brightness = 1.0;
                            tmpHslEnd.Brightness   = 0.0;

                            tmpGradientBrush.RotateTransform(90);
                            tmpFillBounds = tmpLinearBounds = new System.Drawing.Rectangle(BorderSize, BorderSize, 1, tmpBoundHeight);
                            for (int index = 0; index < tmpBoundWidth; index++)
                            {
                                tmpFillBounds.X = index + BorderSize;
                                tmpHslStart.Hue = tmpHslEnd.Hue = (double)index / tmpBoundWidth;

                                tmpGradientBrush.LinearColors = new System.Drawing.Color[] { HuiruiSoft.Drawing.ColorTranslator.HSBToRGB(tmpHslStart), HuiruiSoft.Drawing.ColorTranslator.HSBToRGB(tmpHslEnd) };
                                tmpImageGraphics.FillRectangle(tmpGradientBrush, tmpFillBounds);
                            }
                            break;

                        case HuiruiSoft.Drawing.ColorCubeZAxes.Brightness:
                            tmpHslStart.Brightness = tmpHslEnd.Brightness = this.hsbColor.Brightness;
                            tmpHslStart.Saturation = 1.0;
                            tmpHslEnd.Saturation   = 0.0;
                            tmpFillBounds          = tmpLinearBounds = new System.Drawing.Rectangle(BorderSize, BorderSize, 1, tmpBoundHeight);
                            tmpGradientBrush.RotateTransform(90);

                            for (int index = 0; index < tmpBoundWidth; index++)
                            {
                                tmpFillBounds.X = index + BorderSize;
                                tmpHslStart.Hue = tmpHslEnd.Hue = (double)index / tmpBoundWidth;

                                tmpGradientBrush.LinearColors = new System.Drawing.Color[] { HuiruiSoft.Drawing.ColorTranslator.HSBToRGB(tmpHslStart), HuiruiSoft.Drawing.ColorTranslator.HSBToRGB(tmpHslEnd) };
                                tmpImageGraphics.FillRectangle(tmpGradientBrush, tmpFillBounds);
                            }
                            break;
                        }
                        break;

                    case HuiruiSoft.Drawing.ColorCubeZAxes.Luminance:
                    case HuiruiSoft.Drawing.ColorCubeZAxes.A:
                    case HuiruiSoft.Drawing.ColorCubeZAxes.B:
                        HuiruiSoft.Drawing.CIELabColor tmpLabColor = new HuiruiSoft.Drawing.CIELabColor( );
                        switch (this.cubeZAxes)
                        {
                        case HuiruiSoft.Drawing.ColorCubeZAxes.Luminance:
                            tmpLabColor.L = this.labColor.L;
                            for (int xAxis = 0; xAxis < 256; xAxis++)
                            {
                                tmpLabColor.A = this.Round((double)xAxis * 255 / tmpBoundWidth - 128);
                                for (int yAxis = 0; yAxis < 256; yAxis++)
                                {
                                    tmpLabColor.B = this.Round(127 - (double)yAxis * 255 / tmpBoundHeight);
                                    this.colorPaletteMap.SetPixel(BorderSize + xAxis, BorderSize + yAxis, HuiruiSoft.Drawing.ColorTranslator.CIELabToColor(tmpLabColor));
                                }
                            }
                            break;

                        case HuiruiSoft.Drawing.ColorCubeZAxes.A:
                            tmpLabColor.A = this.labColor.A;

                            for (int xAxis = 0; xAxis < 256; xAxis++)
                            {
                                tmpLabColor.B = this.Round((double)xAxis * 255 / tmpBoundWidth - 128);
                                for (int yAxis = 0; yAxis < 256; yAxis++)
                                {
                                    tmpLabColor.L = this.Round(100 - (double)yAxis * 100 / tmpBoundHeight);
                                    this.colorPaletteMap.SetPixel(BorderSize + xAxis, BorderSize + yAxis, HuiruiSoft.Drawing.ColorTranslator.CIELabToColor(tmpLabColor));
                                }
                            }
                            break;

                        case HuiruiSoft.Drawing.ColorCubeZAxes.B:
                            tmpLabColor.B = this.labColor.B;

                            for (int xAxis = 0; xAxis < 256; xAxis++)
                            {
                                tmpLabColor.A = this.Round((double)xAxis * 255 / tmpBoundWidth - 128);
                                for (int yAxis = 0; yAxis < 256; yAxis++)
                                {
                                    tmpLabColor.L = this.Round(100 - (double)yAxis * 100 / tmpBoundHeight);
                                    this.colorPaletteMap.SetPixel(BorderSize + xAxis, BorderSize + yAxis, HuiruiSoft.Drawing.ColorTranslator.CIELabToColor(tmpLabColor));
                                }
                            }
                            break;
                        }
                        break;
                    }

                    using (var tmpDrawPenObject = new System.Drawing.Pen(System.Drawing.Color.FromArgb(172, 168, 153)))
                    {
                        var tempLeftTop     = new System.Drawing.Point(0, 0);
                        var tempRightTop    = new System.Drawing.Point(this.Width - BorderSize, 0);
                        var tempLeftBottom  = new System.Drawing.Point(0, this.Height - BorderSize);
                        var tempRightBottom = new System.Drawing.Point(this.Width - BorderSize, this.Height - BorderSize);

                        tmpImageGraphics.DrawLine(tmpDrawPenObject, tempLeftTop, tempRightTop);                   //	Draw top line
                        tmpImageGraphics.DrawLine(tmpDrawPenObject, tempLeftTop, tempLeftBottom);                 //	Draw left hand line

                        tmpDrawPenObject.Color = System.Drawing.Color.White;
                        tmpImageGraphics.DrawLine(tmpDrawPenObject, tempRightTop, tempRightBottom);              //	Draw right hand line
                        tmpImageGraphics.DrawLine(tmpDrawPenObject, tempLeftBottom, tempRightBottom);            //	Draw bottome line

                        tmpDrawPenObject.Color = System.Drawing.Color.Black;
                        var tmpInnerBorder = new System.Drawing.Rectangle(tempLeftTop, new System.Drawing.Size(System.Math.Abs(tempRightBottom.X - tempLeftBottom.X), System.Math.Abs(tempRightBottom.Y - tempLeftTop.Y)));
                        tmpInnerBorder.Inflate(-1, -1);
                        tmpImageGraphics.DrawRectangle(tmpDrawPenObject, tmpInnerBorder);       //	Draw inner black rectangle
                    }
                }

                this.Refresh( );
            }
        }
Пример #5
0
        private void ResetHSLRGB( )
        {
            int tmpRGBColorR, tmpRGBColorG, tmpRGBColorB;

            var tmpBoundWidth  = (double)(this.Width - 2 * BorderSize);
            var tmpBoundHeight = (double)(this.Height - 2 * BorderSize);

            switch (this.cubeZAxes)
            {
            case HuiruiSoft.Drawing.ColorCubeZAxes.Red:
            case HuiruiSoft.Drawing.ColorCubeZAxes.Green:
            case HuiruiSoft.Drawing.ColorCubeZAxes.Blue:
                switch (this.cubeZAxes)
                {
                case HuiruiSoft.Drawing.ColorCubeZAxes.Red:
                    tmpRGBColorB      = this.Round(255 * (0.0 + (double)this.markerPositionX / tmpBoundWidth));
                    tmpRGBColorG      = this.Round(255 * (1.0 - (double)this.markerPositionY / tmpBoundHeight));
                    this.currentColor = System.Drawing.Color.FromArgb(this.currentColor.R, tmpRGBColorG, tmpRGBColorB);
                    break;

                case HuiruiSoft.Drawing.ColorCubeZAxes.Green:
                    tmpRGBColorB      = this.Round(255 * (0.0 + (double)this.markerPositionX / tmpBoundWidth));
                    tmpRGBColorR      = this.Round(255 * (1.0 - (double)this.markerPositionY / tmpBoundHeight));
                    this.currentColor = System.Drawing.Color.FromArgb(tmpRGBColorR, this.currentColor.G, tmpRGBColorB);
                    break;

                case HuiruiSoft.Drawing.ColorCubeZAxes.Blue:
                    tmpRGBColorR      = this.Round(255 * (0.0 + (double)this.markerPositionX / tmpBoundWidth));
                    tmpRGBColorG      = this.Round(255 * (1.0 - (double)this.markerPositionY / tmpBoundHeight));
                    this.currentColor = System.Drawing.Color.FromArgb(tmpRGBColorR, tmpRGBColorG, this.currentColor.B);
                    break;
                }
                this.hsbColor = HuiruiSoft.Drawing.ColorTranslator.RGBToHSB(this.currentColor);
                this.labColor = HuiruiSoft.Drawing.ColorTranslator.RGBToCIELab(this.currentColor);

                break;

            case HuiruiSoft.Drawing.ColorCubeZAxes.Hue:
            case HuiruiSoft.Drawing.ColorCubeZAxes.Saturation:
            case HuiruiSoft.Drawing.ColorCubeZAxes.Brightness:
                switch (this.cubeZAxes)
                {
                case HuiruiSoft.Drawing.ColorCubeZAxes.Hue:
                    this.hsbColor.Saturation = (double)this.markerPositionX / tmpBoundWidth;
                    this.hsbColor.Brightness = 1.0 - (double)this.markerPositionY / tmpBoundHeight;
                    break;

                case HuiruiSoft.Drawing.ColorCubeZAxes.Saturation:
                    this.hsbColor.Hue        = (double)this.markerPositionX / tmpBoundWidth;
                    this.hsbColor.Brightness = 1.0 - (double)this.markerPositionY / tmpBoundHeight;
                    break;

                case HuiruiSoft.Drawing.ColorCubeZAxes.Brightness:
                    this.hsbColor.Hue        = (double)this.markerPositionX / tmpBoundWidth;
                    this.hsbColor.Saturation = 1.0 - (double)this.markerPositionY / tmpBoundHeight;
                    break;
                }
                this.currentColor = HuiruiSoft.Drawing.ColorTranslator.HSBToRGB(this.hsbColor);
                this.labColor     = HuiruiSoft.Drawing.ColorTranslator.RGBToCIELab(this.currentColor);

                break;

            case HuiruiSoft.Drawing.ColorCubeZAxes.Luminance:
            case HuiruiSoft.Drawing.ColorCubeZAxes.A:
            case HuiruiSoft.Drawing.ColorCubeZAxes.B:
                switch (this.cubeZAxes)
                {
                case HuiruiSoft.Drawing.ColorCubeZAxes.Luminance:
                    this.labColor.A = this.Round(255 * (double)this.markerPositionX / tmpBoundWidth - 128);
                    this.labColor.B = this.Round(127 - 255 * (double)this.markerPositionY / tmpBoundHeight);
                    break;

                case HuiruiSoft.Drawing.ColorCubeZAxes.A:
                    this.labColor.L = this.Round(100 - (double)this.markerPositionY * 100 / tmpBoundHeight);
                    this.labColor.B = this.Round(255 * (double)this.markerPositionX / tmpBoundWidth - 128);
                    break;

                case HuiruiSoft.Drawing.ColorCubeZAxes.B:
                    this.labColor.L = this.Round(100 - (double)this.markerPositionY * 100 / tmpBoundHeight);
                    this.labColor.A = this.Round(255 * (double)this.markerPositionX / tmpBoundWidth - 128);
                    break;
                }

                this.currentColor = HuiruiSoft.Drawing.ColorTranslator.CIELabToColor(this.labColor);
                this.hsbColor     = HuiruiSoft.Drawing.ColorTranslator.RGBToHSB(this.currentColor);
                break;
            }
        }
Пример #6
0
        private void ResetHSLRGB( )
        {
            if (this.Orientation == Orientation.Vertical)
            {
                int tmpFillHeight = this.Height - 2 * (SliderMarkerSize + 1);

                switch (this.cubeZaxes)
                {
                case HuiruiSoft.Drawing.ColorCubeZAxes.Red:
                case HuiruiSoft.Drawing.ColorCubeZAxes.Green:
                case HuiruiSoft.Drawing.ColorCubeZAxes.Blue:
                    switch (this.cubeZaxes)
                    {
                    case HuiruiSoft.Drawing.ColorCubeZAxes.Red:
                        this.currentColor = System.Drawing.Color.FromArgb(255 - this.Round(255 * (double)this.markerPosition / tmpFillHeight), this.currentColor.G, this.currentColor.B);
                        break;

                    case HuiruiSoft.Drawing.ColorCubeZAxes.Green:
                        this.currentColor = System.Drawing.Color.FromArgb(this.currentColor.R, 255 - this.Round(255 * (double)this.markerPosition / tmpFillHeight), this.currentColor.B);
                        break;

                    case HuiruiSoft.Drawing.ColorCubeZAxes.Blue:
                        this.currentColor = System.Drawing.Color.FromArgb(this.currentColor.R, this.currentColor.G, 255 - this.Round(255 * (double)this.markerPosition / tmpFillHeight));
                        break;
                    }
                    this.hsbColor    = HuiruiSoft.Drawing.ColorTranslator.RGBToHSB(this.currentColor);
                    this.cieLabColor = HuiruiSoft.Drawing.ColorTranslator.RGBToCIELab(this.currentColor);
                    break;

                case HuiruiSoft.Drawing.ColorCubeZAxes.Hue:
                case HuiruiSoft.Drawing.ColorCubeZAxes.Saturation:
                case HuiruiSoft.Drawing.ColorCubeZAxes.Brightness:
                    switch (this.cubeZaxes)
                    {
                    case HuiruiSoft.Drawing.ColorCubeZAxes.Hue:
                        this.hsbColor.Hue = 1.0 - (double)this.markerPosition / tmpFillHeight;
                        break;

                    case HuiruiSoft.Drawing.ColorCubeZAxes.Saturation:
                        this.hsbColor.Saturation = 1.0 - (double)this.markerPosition / tmpFillHeight;
                        break;

                    case HuiruiSoft.Drawing.ColorCubeZAxes.Brightness:
                        this.hsbColor.Brightness = 1.0 - (double)this.markerPosition / tmpFillHeight;
                        break;
                    }
                    this.currentColor = HuiruiSoft.Drawing.ColorTranslator.HSBToRGB(this.hsbColor);
                    this.cieLabColor  = HuiruiSoft.Drawing.ColorTranslator.RGBToCIELab(this.currentColor);
                    break;

                case HuiruiSoft.Drawing.ColorCubeZAxes.Luminance:
                case HuiruiSoft.Drawing.ColorCubeZAxes.A:
                case HuiruiSoft.Drawing.ColorCubeZAxes.B:
                    switch (this.cubeZaxes)
                    {
                    case HuiruiSoft.Drawing.ColorCubeZAxes.Luminance:
                        this.cieLabColor.L = this.Round(100 - (double)this.markerPosition * 100 / tmpFillHeight);
                        break;

                    case HuiruiSoft.Drawing.ColorCubeZAxes.A:
                        this.cieLabColor.A = this.Round(127 - (double)this.markerPosition * 255 / tmpFillHeight);
                        break;

                    case HuiruiSoft.Drawing.ColorCubeZAxes.B:
                        this.cieLabColor.B = this.Round(127 - (double)this.markerPosition * 255 / tmpFillHeight);
                        break;
                    }
                    this.currentColor = HuiruiSoft.Drawing.ColorTranslator.CIELabToColor(this.cieLabColor);
                    this.hsbColor     = HuiruiSoft.Drawing.ColorTranslator.RGBToHSB(this.currentColor);
                    break;
                }
            }
            else
            {
                int tmpFillWidth = this.Width - 2 * (SliderMarkerSize + 1);

                switch (this.cubeZaxes)
                {
                case HuiruiSoft.Drawing.ColorCubeZAxes.Red:
                case HuiruiSoft.Drawing.ColorCubeZAxes.Green:
                case HuiruiSoft.Drawing.ColorCubeZAxes.Blue:
                    switch (this.cubeZaxes)
                    {
                    case HuiruiSoft.Drawing.ColorCubeZAxes.Red:
                        this.currentColor = System.Drawing.Color.FromArgb(this.Round(255 * (double)this.markerPosition / tmpFillWidth), this.currentColor.G, this.currentColor.B);
                        break;

                    case HuiruiSoft.Drawing.ColorCubeZAxes.Green:
                        this.currentColor = System.Drawing.Color.FromArgb(this.currentColor.R, this.Round(255 * (double)this.markerPosition / tmpFillWidth), this.currentColor.B);
                        break;

                    case HuiruiSoft.Drawing.ColorCubeZAxes.Blue:
                        this.currentColor = System.Drawing.Color.FromArgb(this.currentColor.R, this.currentColor.G, this.Round(255 * (double)this.markerPosition / tmpFillWidth));
                        break;
                    }
                    this.hsbColor    = HuiruiSoft.Drawing.ColorTranslator.RGBToHSB(this.currentColor);
                    this.cieLabColor = HuiruiSoft.Drawing.ColorTranslator.RGBToCIELab(this.currentColor);
                    break;

                case HuiruiSoft.Drawing.ColorCubeZAxes.Hue:
                case HuiruiSoft.Drawing.ColorCubeZAxes.Saturation:
                case HuiruiSoft.Drawing.ColorCubeZAxes.Brightness:
                    switch (this.cubeZaxes)
                    {
                    case HuiruiSoft.Drawing.ColorCubeZAxes.Hue:
                        this.hsbColor.Hue = (double)this.markerPosition / tmpFillWidth;
                        break;

                    case HuiruiSoft.Drawing.ColorCubeZAxes.Saturation:
                        this.hsbColor.Saturation = (double)this.markerPosition / tmpFillWidth;
                        break;

                    case HuiruiSoft.Drawing.ColorCubeZAxes.Brightness:
                        this.hsbColor.Brightness = (double)this.markerPosition / tmpFillWidth;
                        break;
                    }
                    this.currentColor = HuiruiSoft.Drawing.ColorTranslator.HSBToRGB(this.hsbColor);
                    this.cieLabColor  = HuiruiSoft.Drawing.ColorTranslator.RGBToCIELab(this.currentColor);
                    break;

                case HuiruiSoft.Drawing.ColorCubeZAxes.Luminance:
                case HuiruiSoft.Drawing.ColorCubeZAxes.A:
                case HuiruiSoft.Drawing.ColorCubeZAxes.B:
                    switch (this.cubeZaxes)
                    {
                    case HuiruiSoft.Drawing.ColorCubeZAxes.Luminance:
                        this.cieLabColor.L = this.Round((double)this.markerPosition * 100 / tmpFillWidth);
                        break;

                    case HuiruiSoft.Drawing.ColorCubeZAxes.A:
                        this.cieLabColor.A = this.Round((double)this.markerPosition * 255 / tmpFillWidth - 128);
                        break;

                    case HuiruiSoft.Drawing.ColorCubeZAxes.B:
                        this.cieLabColor.B = this.Round((double)this.markerPosition * 255 / tmpFillWidth - 128);
                        break;
                    }
                    this.currentColor = HuiruiSoft.Drawing.ColorTranslator.CIELabToColor(this.cieLabColor);
                    this.hsbColor     = HuiruiSoft.Drawing.ColorTranslator.RGBToHSB(this.currentColor);
                    break;
                }
            }
        }