Пример #1
0
 public DrawArrowButtonEventArgs(Graphics graphics, Rectangle bounds, ScrollBarElementState state, ScrollBarArrow type) : base(graphics, bounds, state)
 {
     this._type = type;
 }
Пример #2
0
        private void DoDrawArrowButton(Graphics gr, Rectangle drawRect, ScrollBarArrow type, ScrollBarElementState state)
        {
            ScrollBarButton leftUpButton = null;
            if ((type == ScrollBarArrow.Left) || (type == ScrollBarArrow.Up))
            {
                switch (state)
                {
                    case ScrollBarElementState.Normal:
                        leftUpButton = this.LeftUpButton;
                        goto Label_006B;

                    case ScrollBarElementState.Pressed:
                        leftUpButton = this.LeftUpButtonHighlight;
                        goto Label_006B;

                    case ScrollBarElementState.Disabled:
                        leftUpButton = this.LeftUpButtonDisabled;
                        goto Label_006B;
                }
            }
            else
            {
                switch (state)
                {
                    case ScrollBarElementState.Normal:
                        leftUpButton = this.RightDownButton;
                        goto Label_006B;

                    case ScrollBarElementState.Pressed:
                        leftUpButton = this.RightDownButtonHighlight;
                        goto Label_006B;

                    case ScrollBarElementState.Disabled:
                        leftUpButton = this.RightDownButtonDisabled;
                        goto Label_006B;
                }
            }
            Label_006B:
            if (leftUpButton == null)
            {
                switch (state)
                {
                    case ScrollBarElementState.Normal:
                        leftUpButton = ScrollBarButton.Default;
                        break;

                    case ScrollBarElementState.Pressed:
                        leftUpButton = ScrollBarButton.DefaultHighlight;
                        break;

                    case ScrollBarElementState.Disabled:
                        leftUpButton = ScrollBarButton.DefaultDisabled;
                        break;
                }
            }
            Color window = SystemColors.Window;
            if (base.Parent != null)
            {
                window = base.Parent.BackColor;
            }
            leftUpButton.Draw(gr, drawRect, type, window);
        }
Пример #3
0
        private void DoDrawArrow(Graphics gr, Rectangle drawRect, ScrollBarArrow type)
        {
            if (this._arrowImage != null)
            {
                Rectangle rectangle;
                if (this._arrowImageLayout == ScrollBarButtonArrowImageLayout.Center)
                {
                    rectangle = new Rectangle(drawRect.Left + ((drawRect.Width - this._arrowImage.Width) / 2), drawRect.Top + ((drawRect.Height - this._arrowImage.Height) / 2), this._arrowImage.Width, this._arrowImage.Height);
                }
                else
                {
                    rectangle = drawRect;
                }
                gr.DrawImage(this._arrowImage, rectangle, 0, 0, this._arrowImage.Width, this._arrowImage.Height, GraphicsUnit.Pixel, this._imageAttributes);
            }
            else
            {
                drawRect.Inflate(-1, -1);
                if (((drawRect.Width > 0) && (drawRect.Height > 0)) && (this._arrowColor != System.Drawing.Color.Transparent))
                {
                    int num  = 0;
                    int left = drawRect.Left;
                    int top  = drawRect.Top;
                    int num4 = 0;
                    int num5 = 0;
                    switch (type)
                    {
                    case ScrollBarArrow.Left:
                    case ScrollBarArrow.Right:
                        num   = (drawRect.Width < 5) ? drawRect.Width : 5;
                        left += ((drawRect.Width - num) / 2) + ((type == ScrollBarArrow.Right) ? num : 0);
                        top  += drawRect.Height / 2;
                        num4  = (type == ScrollBarArrow.Left) ? 1 : -1;
                        num5  = -1;
                        break;

                    case ScrollBarArrow.Up:
                    case ScrollBarArrow.Down:
                        num   = (drawRect.Height < 5) ? drawRect.Height : 5;
                        left += drawRect.Width / 2;
                        top  += ((drawRect.Height - num) / 2) + ((type == ScrollBarArrow.Down) ? (num - 1) : 0);
                        num4  = (type == ScrollBarArrow.Down) ? 1 : -1;
                        num5  = (type == ScrollBarArrow.Down) ? -1 : 1;
                        break;
                    }
                    int num6 = (type == ScrollBarArrow.Up) ? 2 : ((type == ScrollBarArrow.Down) ? -2 : 0);
                    int num7 = ((type == ScrollBarArrow.Left) || (type == ScrollBarArrow.Right)) ? 2 : 0;
                    int num8 = num6;
                    int num9 = num7;
                    Pen pen  = Resco.Controls.ScrollBar.ScrollBar.GetPen(this._arrowColor);
                    Resco.Controls.ScrollBar.ScrollBar.DrawPixel(gr, this._arrowColor, left, top);
                    for (int i = 1; i < num; i++)
                    {
                        left += num4;
                        top  += num5;
                        gr.DrawLine(pen, left, top, left + num6, top + num7);
                        num6 += num8;
                        num7 += num9;
                    }
                }
            }
        }
Пример #4
0
        public void Draw(Graphics gr, Rectangle drawRect, ScrollBarArrow type, System.Drawing.Color parentColor)
        {
            if (this._borderStyle != ScrollBarBorderStyle.None)
            {
                Resco.Controls.ScrollBar.ScrollBar.BorderSide all = Resco.Controls.ScrollBar.ScrollBar.BorderSide.All;
                if (!this._borderClosed)
                {
                    switch (type)
                    {
                    case ScrollBarArrow.Left:
                        all &= ~Resco.Controls.ScrollBar.ScrollBar.BorderSide.Right;
                        break;

                    case ScrollBarArrow.Right:
                        all &= ~Resco.Controls.ScrollBar.ScrollBar.BorderSide.Left;
                        break;

                    case ScrollBarArrow.Up:
                        all &= ~Resco.Controls.ScrollBar.ScrollBar.BorderSide.Down;
                        break;

                    case ScrollBarArrow.Down:
                        all &= ~Resco.Controls.ScrollBar.ScrollBar.BorderSide.Up;
                        break;
                    }
                }
                Resco.Controls.ScrollBar.ScrollBar.DoDrawBorder(gr, this._borderStyle, this._borderColor, drawRect, all, parentColor);
                drawRect.Inflate(-1, -1);
                if (all != Resco.Controls.ScrollBar.ScrollBar.BorderSide.All)
                {
                    if ((type == ScrollBarArrow.Left) || (type == ScrollBarArrow.Right))
                    {
                        drawRect.Width++;
                        if (type == ScrollBarArrow.Right)
                        {
                            drawRect.X--;
                        }
                    }
                    else
                    {
                        drawRect.Height++;
                        if (type == ScrollBarArrow.Down)
                        {
                            drawRect.Y--;
                        }
                    }
                }
            }
            if ((drawRect.Width > 0) && (drawRect.Height > 0))
            {
                if (this._image != null)
                {
                    gr.DrawImage(this._image, drawRect, new Rectangle(0, 0, this._image.Width, this._image.Height), GraphicsUnit.Pixel);
                }
                else if (this._gradientColor.CanDraw())
                {
                    this._gradientColor.DrawGradient(gr, drawRect);
                }
                else
                {
                    gr.FillRectangle(Resco.Controls.ScrollBar.ScrollBar.GetBrush(this._color), drawRect);
                }
                Region clip         = gr.Clip;
                Region helperRegion = Resco.Controls.ScrollBar.ScrollBar.GetHelperRegion();
                helperRegion.MakeEmpty();
                helperRegion.Union(drawRect);
                gr.Clip = helperRegion;
                this.DoDrawArrow(gr, drawRect, type);
                gr.Clip = clip;
            }
        }
Пример #5
0
        private void DoDrawArrow(Graphics gr, Rectangle drawRect, ScrollBarArrow type)
        {
            if (this._arrowImage != null)
            {
                Rectangle rectangle;
                if (this._arrowImageLayout == ScrollBarButtonArrowImageLayout.Center)
                {
                    rectangle = new Rectangle(drawRect.Left + ((drawRect.Width - this._arrowImage.Width) / 2), drawRect.Top + ((drawRect.Height - this._arrowImage.Height) / 2), this._arrowImage.Width, this._arrowImage.Height);
                }
                else
                {
                    rectangle = drawRect;
                }
                gr.DrawImage(this._arrowImage, rectangle, 0, 0, this._arrowImage.Width, this._arrowImage.Height, GraphicsUnit.Pixel, this._imageAttributes);
            }
            else
            {
                drawRect.Inflate(-1, -1);
                if (((drawRect.Width > 0) && (drawRect.Height > 0)) && (this._arrowColor != System.Drawing.Color.Transparent))
                {
                    int num = 0;
                    int left = drawRect.Left;
                    int top = drawRect.Top;
                    int num4 = 0;
                    int num5 = 0;
                    switch (type)
                    {
                        case ScrollBarArrow.Left:
                        case ScrollBarArrow.Right:
                            num = (drawRect.Width < 5) ? drawRect.Width : 5;
                            left += ((drawRect.Width - num) / 2) + ((type == ScrollBarArrow.Right) ? num : 0);
                            top += drawRect.Height / 2;
                            num4 = (type == ScrollBarArrow.Left) ? 1 : -1;
                            num5 = -1;
                            break;

                        case ScrollBarArrow.Up:
                        case ScrollBarArrow.Down:
                            num = (drawRect.Height < 5) ? drawRect.Height : 5;
                            left += drawRect.Width / 2;
                            top += ((drawRect.Height - num) / 2) + ((type == ScrollBarArrow.Down) ? (num - 1) : 0);
                            num4 = (type == ScrollBarArrow.Down) ? 1 : -1;
                            num5 = (type == ScrollBarArrow.Down) ? -1 : 1;
                            break;
                    }
                    int num6 = (type == ScrollBarArrow.Up) ? 2 : ((type == ScrollBarArrow.Down) ? -2 : 0);
                    int num7 = ((type == ScrollBarArrow.Left) || (type == ScrollBarArrow.Right)) ? 2 : 0;
                    int num8 = num6;
                    int num9 = num7;
                    Pen pen = Resco.Controls.ScrollBar.ScrollBar.GetPen(this._arrowColor);
                    Resco.Controls.ScrollBar.ScrollBar.DrawPixel(gr, this._arrowColor, left, top);
                    for (int i = 1; i < num; i++)
                    {
                        left += num4;
                        top += num5;
                        gr.DrawLine(pen, left, top, left + num6, top + num7);
                        num6 += num8;
                        num7 += num9;
                    }
                }
            }
        }
Пример #6
0
        public void Draw(Graphics gr, Rectangle drawRect, ScrollBarArrow type, System.Drawing.Color parentColor)
        {
            if (this._borderStyle != ScrollBarBorderStyle.None)
            {
                Resco.Controls.ScrollBar.ScrollBar.BorderSide all = Resco.Controls.ScrollBar.ScrollBar.BorderSide.All;
                if (!this._borderClosed)
                {
                    switch (type)
                    {
                        case ScrollBarArrow.Left:
                            all &= ~Resco.Controls.ScrollBar.ScrollBar.BorderSide.Right;
                            break;

                        case ScrollBarArrow.Right:
                            all &= ~Resco.Controls.ScrollBar.ScrollBar.BorderSide.Left;
                            break;

                        case ScrollBarArrow.Up:
                            all &= ~Resco.Controls.ScrollBar.ScrollBar.BorderSide.Down;
                            break;

                        case ScrollBarArrow.Down:
                            all &= ~Resco.Controls.ScrollBar.ScrollBar.BorderSide.Up;
                            break;
                    }
                }
                Resco.Controls.ScrollBar.ScrollBar.DoDrawBorder(gr, this._borderStyle, this._borderColor, drawRect, all, parentColor);
                drawRect.Inflate(-1, -1);
                if (all != Resco.Controls.ScrollBar.ScrollBar.BorderSide.All)
                {
                    if ((type == ScrollBarArrow.Left) || (type == ScrollBarArrow.Right))
                    {
                        drawRect.Width++;
                        if (type == ScrollBarArrow.Right)
                        {
                            drawRect.X--;
                        }
                    }
                    else
                    {
                        drawRect.Height++;
                        if (type == ScrollBarArrow.Down)
                        {
                            drawRect.Y--;
                        }
                    }
                }
            }
            if ((drawRect.Width > 0) && (drawRect.Height > 0))
            {
                if (this._image != null)
                {
                    gr.DrawImage(this._image, drawRect, new Rectangle(0, 0, this._image.Width, this._image.Height), GraphicsUnit.Pixel);
                }
                else if (this._gradientColor.CanDraw())
                {
                    this._gradientColor.DrawGradient(gr, drawRect);
                }
                else
                {
                    gr.FillRectangle(Resco.Controls.ScrollBar.ScrollBar.GetBrush(this._color), drawRect);
                }
                Region clip = gr.Clip;
                Region helperRegion = Resco.Controls.ScrollBar.ScrollBar.GetHelperRegion();
                helperRegion.MakeEmpty();
                helperRegion.Union(drawRect);
                gr.Clip = helperRegion;
                this.DoDrawArrow(gr, drawRect, type);
                gr.Clip = clip;
            }
        }
Пример #7
0
 public DrawArrowButtonEventArgs(Graphics graphics, Rectangle bounds, ScrollBarElementState state, ScrollBarArrow type)
     : base(graphics, bounds, state)
 {
     this._type = type;
 }