Пример #1
0
        internal RectangleF GetScrollBarButtonRect(RectangleF scrollBarClientRect, ScrollBarButtonType buttonType)
        {
            RectangleF result = new RectangleF(scrollBarClientRect.Location, scrollBarClientRect.Size);
            bool       flag   = (axis.AxisPosition == AxisPosition.Left || axis.AxisPosition == AxisPosition.Right) ? true : false;
            SizeF      size   = new SizeF(1f, 1f);

            size = GetRelativeSize(size);
            SizeF relative = new SizeF(scrollBarClientRect.Width, scrollBarClientRect.Height);

            relative = GetAbsoluteSize(relative);
            if (flag)
            {
                relative.Height = relative.Width;
            }
            else
            {
                relative.Width = relative.Height;
            }
            relative      = GetRelativeSize(relative);
            result.Width  = relative.Width;
            result.Height = relative.Height;
            if (flag)
            {
                result.X = scrollBarClientRect.X;
            }
            else
            {
                result.Y = scrollBarClientRect.Y;
            }
            switch (buttonType)
            {
            case ScrollBarButtonType.ThumbTracker:
            case ScrollBarButtonType.LargeDecrement:
            case ScrollBarButtonType.LargeIncrement:
                if (flag)
                {
                    double num = scrollBarClientRect.Height - (float)GetButtonsNumberAll() * relative.Height;
                    result.Height = (float)(GetDataViewPercentage() * (num / 100.0));
                    if (result.Height < size.Height * 6f)
                    {
                        result.Height = size.Height * 6f;
                    }
                    if (!axis.Reverse)
                    {
                        result.Y  = scrollBarClientRect.Bottom - (float)GetButtonsNumberBottom() * relative.Height - result.Height;
                        result.Y -= (float)(GetDataViewPositionPercentage() * (num / 100.0));
                        if (result.Y < scrollBarClientRect.Y + (float)GetButtonsNumberTop() * relative.Height + ((GetButtonsNumberTop() == 0) ? 0f : size.Height))
                        {
                            result.Y = scrollBarClientRect.Y + (float)GetButtonsNumberTop() * relative.Height + ((GetButtonsNumberTop() == 0) ? 0f : size.Height);
                        }
                    }
                    else
                    {
                        result.Y  = scrollBarClientRect.Top + (float)GetButtonsNumberTop() * relative.Height;
                        result.Y += (float)(GetDataViewPositionPercentage() * (num / 100.0));
                        if (result.Y + result.Height > scrollBarClientRect.Bottom - (float)GetButtonsNumberBottom() * relative.Height - ((GetButtonsNumberBottom() == 0) ? 0f : size.Height))
                        {
                            result.Y = scrollBarClientRect.Bottom - (float)GetButtonsNumberBottom() * relative.Height - result.Height - ((GetButtonsNumberBottom() == 0) ? 0f : size.Height);
                        }
                    }
                }
                else
                {
                    double num2 = scrollBarClientRect.Width - (float)GetButtonsNumberAll() * relative.Width;
                    result.Width = (float)(GetDataViewPercentage() * (num2 / 100.0));
                    if (result.Width < size.Width * 6f)
                    {
                        result.Width = size.Width * 6f;
                    }
                    if (!axis.Reverse)
                    {
                        result.X  = scrollBarClientRect.X + (float)GetButtonsNumberTop() * relative.Width;
                        result.X += (float)(GetDataViewPositionPercentage() * (num2 / 100.0));
                        if (result.X + result.Width > scrollBarClientRect.Right - (float)GetButtonsNumberBottom() * relative.Width - ((GetButtonsNumberBottom() == 0) ? 0f : size.Width))
                        {
                            result.X = scrollBarClientRect.Right - result.Width - (float)GetButtonsNumberBottom() * relative.Width - ((GetButtonsNumberBottom() == 0) ? 0f : size.Width);
                        }
                    }
                    else
                    {
                        result.X  = scrollBarClientRect.Right - (float)GetButtonsNumberBottom() * relative.Width - ((GetButtonsNumberBottom() == 0) ? 0f : size.Width) - result.Width;
                        result.X -= (float)(GetDataViewPositionPercentage() * (num2 / 100.0));
                        if (result.X < scrollBarClientRect.X + (float)GetButtonsNumberTop() * relative.Width)
                        {
                            result.X = scrollBarClientRect.X + (float)GetButtonsNumberTop() * relative.Width;
                        }
                    }
                }
                switch (buttonType)
                {
                case ScrollBarButtonType.LargeDecrement:
                    if (flag)
                    {
                        result.Y      = result.Bottom + size.Height;
                        result.Height = scrollBarClientRect.Bottom - (float)GetButtonsNumberBottom() * relative.Height - size.Height - result.Y;
                    }
                    else
                    {
                        float num4 = scrollBarClientRect.X + (float)GetButtonsNumberTop() * relative.Width + size.Width;
                        result.Width = result.X - num4;
                        result.X     = num4;
                    }
                    break;

                case ScrollBarButtonType.LargeIncrement:
                    if (flag)
                    {
                        float num3 = scrollBarClientRect.Y + (float)GetButtonsNumberTop() * relative.Height + size.Height;
                        result.Height = result.Y - num3;
                        result.Y      = num3;
                    }
                    else
                    {
                        result.X     = result.Right + size.Width;
                        result.Width = scrollBarClientRect.Right - (float)GetButtonsNumberBottom() * relative.Width - size.Height - result.X;
                    }
                    break;
                }
                break;

            case ScrollBarButtonType.SmallDecrement:
                if (scrollBarButtonStyle == ScrollBarButtonStyles.All || scrollBarButtonStyle == ScrollBarButtonStyles.SmallScroll)
                {
                    if (flag)
                    {
                        result.Y = scrollBarClientRect.Bottom - result.Height;
                        break;
                    }
                    result.X  = scrollBarClientRect.X + ((float)GetButtonsNumberTop() - 1f) * relative.Width;
                    result.X += ((GetButtonsNumberTop() == 1) ? 0f : size.Width);
                    break;
                }
                return(RectangleF.Empty);

            case ScrollBarButtonType.SmallIncrement:
                if (scrollBarButtonStyle == ScrollBarButtonStyles.All || scrollBarButtonStyle == ScrollBarButtonStyles.SmallScroll)
                {
                    if (flag)
                    {
                        result.Y  = scrollBarClientRect.Y + ((float)GetButtonsNumberTop() - 1f) * relative.Height;
                        result.Y += ((GetButtonsNumberTop() == 1) ? 0f : size.Height);
                    }
                    else
                    {
                        result.X = scrollBarClientRect.Right - result.Width;
                    }
                    break;
                }
                return(RectangleF.Empty);

            case ScrollBarButtonType.ZoomReset:
                if (scrollBarButtonStyle == ScrollBarButtonStyles.All || scrollBarButtonStyle == ScrollBarButtonStyles.ResetZoom)
                {
                    if (flag)
                    {
                        result.Y = scrollBarClientRect.Y;
                    }
                    else
                    {
                        result.X = scrollBarClientRect.X;
                    }
                    break;
                }
                return(RectangleF.Empty);
            }
            return(result);
        }
        public RectangleF GetScrollBarButtonRect(RectangleF scrollBarClientRect, ScrollBarButtonType buttonType)
        {
            RectangleF result = new RectangleF(scrollBarClientRect.Location, scrollBarClientRect.Size);
            bool       flag   = (byte)((this.axis.AxisPosition == AxisPosition.Left || this.axis.AxisPosition == AxisPosition.Right) ? 1 : 0) != 0;
            SizeF      size   = new SizeF(1f, 1f);

            size = this.GetRelativeSize(size);
            SizeF sizeF = new SizeF(scrollBarClientRect.Width, scrollBarClientRect.Height);

            sizeF = this.GetAbsoluteSize(sizeF);
            if (flag)
            {
                sizeF.Height = sizeF.Width;
            }
            else
            {
                sizeF.Width = sizeF.Height;
            }
            sizeF         = this.GetRelativeSize(sizeF);
            result.Width  = sizeF.Width;
            result.Height = sizeF.Height;
            if (flag)
            {
                result.X = scrollBarClientRect.X;
            }
            else
            {
                result.Y = scrollBarClientRect.Y;
            }
            switch (buttonType)
            {
            case ScrollBarButtonType.ThumbTracker:
            case ScrollBarButtonType.LargeDecrement:
            case ScrollBarButtonType.LargeIncrement:
                if (flag)
                {
                    double num = (double)(scrollBarClientRect.Height - (float)this.GetButtonsNumberAll() * sizeF.Height);
                    result.Height = (float)(this.GetDataViewPercentage() * (num / 100.0));
                    if (result.Height < size.Height * 6.0)
                    {
                        result.Height = (float)(size.Height * 6.0);
                    }
                    if (!this.axis.Reverse)
                    {
                        result.Y  = scrollBarClientRect.Bottom - (float)this.GetButtonsNumberBottom() * sizeF.Height - result.Height;
                        result.Y -= (float)(this.GetDataViewPositionPercentage() * (num / 100.0));
                        if (result.Y < scrollBarClientRect.Y + (float)this.GetButtonsNumberTop() * sizeF.Height + ((this.GetButtonsNumberTop() == 0) ? 0.0 : size.Height))
                        {
                            result.Y = (float)(scrollBarClientRect.Y + (float)this.GetButtonsNumberTop() * sizeF.Height + ((this.GetButtonsNumberTop() == 0) ? 0.0 : size.Height));
                        }
                    }
                    else
                    {
                        result.Y  = scrollBarClientRect.Top + (float)this.GetButtonsNumberTop() * sizeF.Height;
                        result.Y += (float)(this.GetDataViewPositionPercentage() * (num / 100.0));
                        if (result.Y + result.Height > scrollBarClientRect.Bottom - (float)this.GetButtonsNumberBottom() * sizeF.Height - ((this.GetButtonsNumberBottom() == 0) ? 0.0 : size.Height))
                        {
                            result.Y = (float)(scrollBarClientRect.Bottom - (float)this.GetButtonsNumberBottom() * sizeF.Height - result.Height - ((this.GetButtonsNumberBottom() == 0) ? 0.0 : size.Height));
                        }
                    }
                }
                else
                {
                    double num2 = (double)(scrollBarClientRect.Width - (float)this.GetButtonsNumberAll() * sizeF.Width);
                    result.Width = (float)(this.GetDataViewPercentage() * (num2 / 100.0));
                    if (result.Width < size.Width * 6.0)
                    {
                        result.Width = (float)(size.Width * 6.0);
                    }
                    if (!this.axis.Reverse)
                    {
                        result.X  = scrollBarClientRect.X + (float)this.GetButtonsNumberTop() * sizeF.Width;
                        result.X += (float)(this.GetDataViewPositionPercentage() * (num2 / 100.0));
                        if (result.X + result.Width > scrollBarClientRect.Right - (float)this.GetButtonsNumberBottom() * sizeF.Width - ((this.GetButtonsNumberBottom() == 0) ? 0.0 : size.Width))
                        {
                            result.X = (float)(scrollBarClientRect.Right - result.Width - (float)this.GetButtonsNumberBottom() * sizeF.Width - ((this.GetButtonsNumberBottom() == 0) ? 0.0 : size.Width));
                        }
                    }
                    else
                    {
                        result.X  = (float)(scrollBarClientRect.Right - (float)this.GetButtonsNumberBottom() * sizeF.Width - ((this.GetButtonsNumberBottom() == 0) ? 0.0 : size.Width) - result.Width);
                        result.X -= (float)(this.GetDataViewPositionPercentage() * (num2 / 100.0));
                        if (result.X < scrollBarClientRect.X + (float)this.GetButtonsNumberTop() * sizeF.Width)
                        {
                            result.X = scrollBarClientRect.X + (float)this.GetButtonsNumberTop() * sizeF.Width;
                        }
                    }
                }
                switch (buttonType)
                {
                case ScrollBarButtonType.LargeDecrement:
                    if (flag)
                    {
                        result.Y      = result.Bottom + size.Height;
                        result.Height = scrollBarClientRect.Bottom - (float)this.GetButtonsNumberBottom() * sizeF.Height - size.Height - result.Y;
                    }
                    else
                    {
                        float num4 = scrollBarClientRect.X + (float)this.GetButtonsNumberTop() * sizeF.Width + size.Width;
                        result.Width = result.X - num4;
                        result.X     = num4;
                    }
                    break;

                case ScrollBarButtonType.LargeIncrement:
                    if (flag)
                    {
                        float num3 = scrollBarClientRect.Y + (float)this.GetButtonsNumberTop() * sizeF.Height + size.Height;
                        result.Height = result.Y - num3;
                        result.Y      = num3;
                    }
                    else
                    {
                        result.X     = result.Right + size.Width;
                        result.Width = scrollBarClientRect.Right - (float)this.GetButtonsNumberBottom() * sizeF.Width - size.Height - result.X;
                    }
                    break;
                }
                break;

            case ScrollBarButtonType.SmallDecrement:
                if (this.scrollBarButtonStyle != ScrollBarButtonStyles.All && this.scrollBarButtonStyle != ScrollBarButtonStyles.SmallScroll)
                {
                    result = RectangleF.Empty;
                    return(result);
                }
                if (flag)
                {
                    result.Y = scrollBarClientRect.Bottom - result.Height;
                }
                else
                {
                    result.X  = (float)(scrollBarClientRect.X + ((float)this.GetButtonsNumberTop() - 1.0) * sizeF.Width);
                    result.X += (float)((this.GetButtonsNumberTop() == 1) ? 0.0 : size.Width);
                }
                break;

            case ScrollBarButtonType.SmallIncrement:
                if (this.scrollBarButtonStyle != ScrollBarButtonStyles.All && this.scrollBarButtonStyle != ScrollBarButtonStyles.SmallScroll)
                {
                    result = RectangleF.Empty;
                    return(result);
                }
                if (flag)
                {
                    result.Y  = (float)(scrollBarClientRect.Y + ((float)this.GetButtonsNumberTop() - 1.0) * sizeF.Height);
                    result.Y += (float)((this.GetButtonsNumberTop() == 1) ? 0.0 : size.Height);
                }
                else
                {
                    result.X = scrollBarClientRect.Right - result.Width;
                }
                break;

            case ScrollBarButtonType.ZoomReset:
                if (this.scrollBarButtonStyle != ScrollBarButtonStyles.All && this.scrollBarButtonStyle != ScrollBarButtonStyles.ResetZoom)
                {
                    result = RectangleF.Empty;
                    return(result);
                }
                if (flag)
                {
                    result.Y = scrollBarClientRect.Y;
                }
                else
                {
                    result.X = scrollBarClientRect.X;
                }
                break;
            }
            return(result);
        }
Пример #3
0
        internal void PaintScrollBar3DButton(ChartGraphics graph, RectangleF buttonRect, bool pressedState, ScrollBarButtonType buttonType)
        {
            if (buttonType == ScrollBarButtonType.LargeIncrement || buttonType == ScrollBarButtonType.LargeDecrement)
            {
                return;
            }
            Color gradientColor  = ChartGraphics.GetGradientColor(buttonCurrentColor, Color.Black, 0.5);
            Color gradientColor2 = ChartGraphics.GetGradientColor(buttonCurrentColor, Color.Black, 0.8);
            Color gradientColor3 = ChartGraphics.GetGradientColor(buttonCurrentColor, Color.White, 0.5);

            graph.FillRectangleRel(buttonRect, buttonCurrentColor, ChartHatchStyle.None, "", ChartImageWrapMode.Tile, Color.Empty, ChartImageAlign.Center, GradientType.None, Color.Empty, gradientColor, pressedState ? 1 : 0, ChartDashStyle.Solid, Color.Empty, 0, PenAlignment.Outset);
            bool flag = Size <= 12.0;

            if (!pressedState)
            {
                SizeF size = new SizeF(1f, 1f);
                size = graph.GetRelativeSize(size);
                graph.DrawLineRel(flag ? gradientColor3 : buttonCurrentColor, 1, ChartDashStyle.Solid, new PointF(buttonRect.X, buttonRect.Bottom), new PointF(buttonRect.X, buttonRect.Top));
                graph.DrawLineRel(flag ? gradientColor3 : buttonCurrentColor, 1, ChartDashStyle.Solid, new PointF(buttonRect.Left, buttonRect.Y), new PointF(buttonRect.Right, buttonRect.Y));
                graph.DrawLineRel(flag ? gradientColor : gradientColor2, 1, ChartDashStyle.Solid, new PointF(buttonRect.Right, buttonRect.Bottom), new PointF(buttonRect.Right, buttonRect.Top));
                graph.DrawLineRel(flag ? gradientColor : gradientColor2, 1, ChartDashStyle.Solid, new PointF(buttonRect.Left, buttonRect.Bottom), new PointF(buttonRect.Right, buttonRect.Bottom));
                if (!flag)
                {
                    graph.DrawLineRel(gradientColor, 1, ChartDashStyle.Solid, new PointF(buttonRect.Right - size.Width, buttonRect.Bottom - size.Height), new PointF(buttonRect.Right - size.Width, buttonRect.Top + size.Height));
                    graph.DrawLineRel(gradientColor, 1, ChartDashStyle.Solid, new PointF(buttonRect.Left + size.Width, buttonRect.Bottom - size.Height), new PointF(buttonRect.Right - size.Width, buttonRect.Bottom - size.Height));
                    graph.DrawLineRel(gradientColor3, 1, ChartDashStyle.Solid, new PointF(buttonRect.X + size.Width, buttonRect.Bottom - size.Height), new PointF(buttonRect.X + size.Width, buttonRect.Top + size.Height));
                    graph.DrawLineRel(gradientColor3, 1, ChartDashStyle.Solid, new PointF(buttonRect.Left + size.Width, buttonRect.Y + size.Height), new PointF(buttonRect.Right - size.Width, buttonRect.Y + size.Height));
                }
            }
            bool  flag2 = (axis.AxisPosition == AxisPosition.Left || axis.AxisPosition == AxisPosition.Right) ? true : false;
            float num   = flag ? 0.5f : 1f;

            if (pressedState)
            {
                graph.TranslateTransform(num, num);
            }
            RectangleF absoluteRectangle = graph.GetAbsoluteRectangle(buttonRect);
            float      num2 = flag ? 2 : 3;

            switch (buttonType)
            {
            case ScrollBarButtonType.SmallDecrement:
            {
                PointF[] array2 = new PointF[3];
                if (flag2)
                {
                    array2[0].X = absoluteRectangle.X + num2;
                    array2[0].Y = absoluteRectangle.Y + (num2 + 1f);
                    array2[1].X = absoluteRectangle.X + absoluteRectangle.Width / 2f;
                    array2[1].Y = absoluteRectangle.Bottom - num2;
                    array2[2].X = absoluteRectangle.Right - num2;
                    array2[2].Y = absoluteRectangle.Y + (num2 + 1f);
                }
                else
                {
                    array2[0].X = absoluteRectangle.X + num2;
                    array2[0].Y = absoluteRectangle.Y + absoluteRectangle.Height / 2f;
                    array2[1].X = absoluteRectangle.Right - (num2 + 1f);
                    array2[1].Y = absoluteRectangle.Y + num2;
                    array2[2].X = absoluteRectangle.Right - (num2 + 1f);
                    array2[2].Y = absoluteRectangle.Bottom - num2;
                }
                graph.FillPolygon(new SolidBrush(lineCurrentColor), array2);
                break;
            }

            case ScrollBarButtonType.SmallIncrement:
            {
                PointF[] array = new PointF[3];
                if (flag2)
                {
                    array[0].X = absoluteRectangle.X + num2;
                    array[0].Y = absoluteRectangle.Bottom - (num2 + 1f);
                    array[1].X = absoluteRectangle.X + absoluteRectangle.Width / 2f;
                    array[1].Y = absoluteRectangle.Y + num2;
                    array[2].X = absoluteRectangle.Right - num2;
                    array[2].Y = absoluteRectangle.Bottom - (num2 + 1f);
                }
                else
                {
                    array[0].X = absoluteRectangle.Right - num2;
                    array[0].Y = absoluteRectangle.Y + absoluteRectangle.Height / 2f;
                    array[1].X = absoluteRectangle.X + (num2 + 1f);
                    array[1].Y = absoluteRectangle.Y + num2;
                    array[2].X = absoluteRectangle.X + (num2 + 1f);
                    array[2].Y = absoluteRectangle.Bottom - num2;
                }
                graph.FillPolygon(new SolidBrush(lineCurrentColor), array);
                break;
            }

            case ScrollBarButtonType.ZoomReset:
            {
                Pen pen = new Pen(lineCurrentColor, 1f);
                graph.DrawEllipse(pen, absoluteRectangle.X + num2 - 0.5f, absoluteRectangle.Y + num2 - 0.5f, absoluteRectangle.Width - 2f * num2, absoluteRectangle.Height - 2f * num2);
                graph.DrawLine(pen, absoluteRectangle.X + num2 + 1.5f, absoluteRectangle.Y + absoluteRectangle.Height / 2f - 0.5f, absoluteRectangle.Right - num2 - 2.5f, absoluteRectangle.Y + absoluteRectangle.Height / 2f - 0.5f);
                break;
            }
            }
            if (pressedState)
            {
                graph.TranslateTransform(0f - num, 0f - num);
            }
        }
Пример #4
0
        /// <summary>
        /// Draws 3D button in the scroll bar
        /// </summary>
        /// <param name="graph">Chart graphics.</param>
        /// <param name="buttonRect">Button position.</param>
        /// <param name="pressedState">Indicates that button is pressed.</param>
        /// <param name="buttonType">Button type to draw.</param>
        internal void PaintScrollBar3DButton(
            ChartGraphics graph,
            SKRect buttonRect,
            bool pressedState,
            ScrollBarButtonType buttonType)
        {
            // Page Up/Down buttons do not require drawing
            if (buttonType == ScrollBarButtonType.LargeIncrement || buttonType == ScrollBarButtonType.LargeDecrement)
            {
                return;
            }

            // Get 3 levels of colors for button drawing
            var darkerColor  = ChartGraphics.GetGradientColor(_buttonCurrentColor, SKColors.Black, 0.5);
            var darkestColor = ChartGraphics.GetGradientColor(_buttonCurrentColor, SKColors.Black, 0.8);
            var lighterColor = ChartGraphics.GetGradientColor(_buttonCurrentColor, SKColors.White, 0.5);

            // Fill button rectangle background
            graph.FillRectangleRel(
                buttonRect,
                _buttonCurrentColor,
                ChartHatchStyle.None,
                "",
                ChartImageWrapMode.Tile,
                SKColor.Empty,
                ChartImageAlignmentStyle.Center,
                GradientStyle.None,
                SKColor.Empty,
                darkerColor,
                (pressedState) ? 1 : 0,
                ChartDashStyle.Solid,
                SKColor.Empty,
                0,
                PenAlignment.Outset);

            // Check if 2 or 1 pixel border will be drawn (if size too small)
            bool singlePixelBorder = Size <= 12;

            // Draw 3D effect around the button when not pressed
            if (!pressedState)
            {
                // Get relative size of 1 pixel
                SKSize pixelRelativeSize = new(1, 1);
                pixelRelativeSize = graph.GetRelativeSize(pixelRelativeSize);

                // Draw top/left border with button color
                graph.DrawLineRel(
                    (singlePixelBorder) ? lighterColor : _buttonCurrentColor, 1, ChartDashStyle.Solid,
                    new SKPoint(buttonRect.Left, buttonRect.Bottom),
                    new SKPoint(buttonRect.Left, buttonRect.Top));
                graph.DrawLineRel(
                    (singlePixelBorder) ? lighterColor : _buttonCurrentColor, 1, ChartDashStyle.Solid,
                    new SKPoint(buttonRect.Left, buttonRect.Top),
                    new SKPoint(buttonRect.Right, buttonRect.Top));

                // Draw right/bottom border with the darkest color
                graph.DrawLineRel(
                    (singlePixelBorder) ? darkerColor : darkestColor, 1, ChartDashStyle.Solid,
                    new SKPoint(buttonRect.Right, buttonRect.Bottom),
                    new SKPoint(buttonRect.Right, buttonRect.Top));
                graph.DrawLineRel(
                    (singlePixelBorder) ? darkerColor : darkestColor, 1, ChartDashStyle.Solid,
                    new SKPoint(buttonRect.Left, buttonRect.Bottom),
                    new SKPoint(buttonRect.Right, buttonRect.Bottom));

                if (!singlePixelBorder)
                {
                    // Draw right/bottom border (offset 1) with the dark color
                    graph.DrawLineRel(
                        darkerColor, 1, ChartDashStyle.Solid,
                        new SKPoint(buttonRect.Right - pixelRelativeSize.Width, buttonRect.Bottom - pixelRelativeSize.Height),
                        new SKPoint(buttonRect.Right - pixelRelativeSize.Width, buttonRect.Top + pixelRelativeSize.Height));
                    graph.DrawLineRel(
                        darkerColor, 1, ChartDashStyle.Solid,
                        new SKPoint(buttonRect.Left + pixelRelativeSize.Width, buttonRect.Bottom - pixelRelativeSize.Height),
                        new SKPoint(buttonRect.Right - pixelRelativeSize.Width, buttonRect.Bottom - pixelRelativeSize.Height));

                    // Draw top/left border (offset 1) with lighter color
                    graph.DrawLineRel(
                        lighterColor, 1, ChartDashStyle.Solid,
                        new SKPoint(buttonRect.Left + pixelRelativeSize.Width, buttonRect.Bottom - pixelRelativeSize.Height),
                        new SKPoint(buttonRect.Left + pixelRelativeSize.Width, buttonRect.Top + pixelRelativeSize.Height));
                    graph.DrawLineRel(
                        lighterColor, 1, ChartDashStyle.Solid,
                        new SKPoint(buttonRect.Left + pixelRelativeSize.Width, buttonRect.Left + pixelRelativeSize.Height),
                        new SKPoint(buttonRect.Right - pixelRelativeSize.Width, buttonRect.Left + pixelRelativeSize.Height));
                }
            }

            // Check axis orientation
            bool verticalAxis = (axis.AxisPosition == AxisPosition.Left ||
                                 axis.AxisPosition == AxisPosition.Right);

            // Set graphics transformation for button pressed mode
            float pressedShifting = (singlePixelBorder) ? 0.5f : 1f;

            if (pressedState)
            {
                graph.TranslateTransform(pressedShifting, pressedShifting);
            }

            // Draw button image
            SKRect buttonAbsRect = graph.GetAbsoluteRectangle(buttonRect);
            float  imageOffset   = (singlePixelBorder) ? 2 : 3;

            switch (buttonType)
            {
            case (ScrollBarButtonType.SmallDecrement):
            {
                // Calculate triangal points position
                SKPoint[] points = new SKPoint[3];
                if (verticalAxis)
                {
                    points[0].X = buttonAbsRect.Left + imageOffset;
                    points[0].Y = buttonAbsRect.Top + (imageOffset + 1f);
                    points[1].X = buttonAbsRect.Left + buttonAbsRect.Width / 2f;
                    points[1].Y = buttonAbsRect.Bottom - imageOffset;
                    points[2].X = buttonAbsRect.Right - imageOffset;
                    points[2].Y = buttonAbsRect.Top + (imageOffset + 1f);
                }
                else
                {
                    points[0].X = buttonAbsRect.Left + imageOffset;
                    points[0].Y = buttonAbsRect.Top + buttonAbsRect.Height / 2f;
                    points[1].X = buttonAbsRect.Right - (imageOffset + 1f);
                    points[1].Y = buttonAbsRect.Top + imageOffset;
                    points[2].X = buttonAbsRect.Right - (imageOffset + 1f);
                    points[2].Y = buttonAbsRect.Bottom - imageOffset;
                }

                using var brush = new SKPaint { Style = SKPaintStyle.Fill, Color = _lineCurrentColor };

                graph.FillPolygon(brush, points);

                break;
            }

            case (ScrollBarButtonType.SmallIncrement):
            {
                // Calculate triangal points position
                SKPoint[] points = new SKPoint[3];
                if (verticalAxis)
                {
                    points[0].X = buttonAbsRect.Left + imageOffset;
                    points[0].Y = buttonAbsRect.Bottom - (imageOffset + 1f);
                    points[1].X = buttonAbsRect.Left + buttonAbsRect.Width / 2f;
                    points[1].Y = buttonAbsRect.Top + imageOffset;
                    points[2].X = buttonAbsRect.Right - imageOffset;
                    points[2].Y = buttonAbsRect.Bottom - (imageOffset + 1f);
                }
                else
                {
                    points[0].X = buttonAbsRect.Right - imageOffset;
                    points[0].Y = buttonAbsRect.Top + buttonAbsRect.Height / 2f;
                    points[1].X = buttonAbsRect.Left + (imageOffset + 1f);
                    points[1].Y = buttonAbsRect.Top + imageOffset;
                    points[2].X = buttonAbsRect.Left + (imageOffset + 1f);
                    points[2].Y = buttonAbsRect.Bottom - imageOffset;
                }

                using var brush = new SKPaint { Style = SKPaintStyle.Fill, Color = _lineCurrentColor };
                graph.FillPolygon(brush, points);

                break;
            }

            case (ScrollBarButtonType.ZoomReset):
            {
                // Draw circule with a minus sign

                using var pen = new SKPaint { Style = SKPaintStyle.Fill, Color = _lineCurrentColor };

                graph.DrawEllipse(pen, buttonAbsRect.Left + imageOffset - 0.5f, buttonAbsRect.Top + imageOffset - 0.5f, buttonAbsRect.Width - 2f * imageOffset, buttonAbsRect.Height - 2f * imageOffset);
                graph.DrawLine(pen, buttonAbsRect.Left + imageOffset + 1.5f, buttonAbsRect.Top + buttonAbsRect.Height / 2f - 0.5f, buttonAbsRect.Right - imageOffset - 2.5f, buttonAbsRect.Top + buttonAbsRect.Height / 2f - 0.5f);

                break;
            }
            }

            // Reset graphics transformation for button pressed mode
            if (pressedState)
            {
                graph.TranslateTransform(-pressedShifting, -pressedShifting);
            }
        }