/// <summary> /// Draws the far scroll button. /// </summary> /// <param name="g">The graphics to draw on.</param> /// <param name="param">The parameters required to draw the button.</param> public override void DrawFarScrollButton(Graphics g, DrawButtonParams param) { if ((param.State & ItemState.Disabled) != ItemState.Inactive) { var backColor = GetScrollButtonBackColor(param); using (var brush = new SolidBrush(backColor)) { g.FillRectangle(brush, param.Bounds); } } else { var backColor = GetScrollButtonBackColor(param); using (var brush = new SolidBrush(backColor)) { g.FillRectangle(brush, param.Bounds); } using (var img = InvertBitmap(Parent.IsHorizontal ? Parent.RightArrowImage : Parent.DownArrowImage)) { var rec = new Rectangle(Point.Empty, img.Size).GetCenteredInside(param.Bounds); g.DrawImage(img, rec); } } }
/// <summary> /// Draws the far scroll button. /// </summary> /// <param name="g">The graphics to draw on.</param> /// <param name="param">The parameters required to draw the button.</param> public virtual void DrawFarScrollButton(Graphics g, DrawButtonParams param) { var backColor = GetScrollButtonBackColor(param); using (var brush = new SolidBrush(backColor)) { g.FillRectangle(brush, param.Bounds); } Image img = Parent.IsHorizontal ? Parent.RightArrowImage : Parent.DownArrowImage; var rec = new Rectangle(Point.Empty, img.Size).GetCenteredInside(param.Bounds); if ((param.State & ItemState.Disabled) != ItemState.Inactive) { ControlPaint.DrawImageDisabled(g, img, rec.X, rec.Y, backColor); } else { g.DrawImage(img, rec); } if (Parent.BorderStyle != BorderStyle.None) { using (Pen pen = new Pen(BorderColor)) { if ((Parent.TabLocation & TabLocation.Top) != TabLocation.None) { g.DrawLine(pen, param.Bounds.Left, param.Bounds.Bottom - 1, param.Bounds.Right - 1, param.Bounds.Bottom - 1); } else if ((Parent.TabLocation & TabLocation.Bottom) != TabLocation.None) { g.DrawLine(pen, param.Bounds.Left, param.Bounds.Top, param.Bounds.Right - 1, param.Bounds.Top); } else if ((Parent.TabLocation & TabLocation.Left) != TabLocation.None) { g.DrawLine(pen, param.Bounds.Right - 1, param.Bounds.Top, param.Bounds.Right - 1, param.Bounds.Bottom - 1); } else { g.DrawLine(pen, param.Bounds.Left, param.Bounds.Top, param.Bounds.Left, param.Bounds.Bottom - 1); } } } }
/// <summary> /// Returns scroll button backcolor for the given state. /// </summary> /// <param name="param">The state of the button.</param> protected Color GetScrollButtonBackColor(DrawButtonParams param) { if ((param.State & ItemState.Disabled) != ItemState.Inactive) { return(InactiveButtonBackColor); } else if ((param.State & ItemState.Pressed) != ItemState.Inactive) { return(PressedButtonBackColor); } else if ((param.State & ItemState.Hot) != ItemState.Inactive) { return(HotButtonBackColor); } else { return(InactiveButtonBackColor); } }