/// <summary> /// Renders the background of a panel background /// </summary> /// <param name="e"></param> public virtual void OnRenderPanelPopupBackground(RibbonCanvasEventArgs e) { }
public override void OnRenderDropDownBackground(RibbonCanvasEventArgs e) { Rectangle outerR = new Rectangle(0, 0, e.Bounds.Width - 1, e.Bounds.Height - 1); Rectangle imgsR = new Rectangle(0, 0, 26, e.Bounds.Height); RibbonDropDown dd = e.Canvas as RibbonDropDown; using (SolidBrush b = new SolidBrush(ColorTable.DropDownBg)) { e.Graphics.Clear(Color.Transparent); SmoothingMode sbuff = e.Graphics.SmoothingMode; e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.FillRectangle(b, outerR); e.Graphics.SmoothingMode = sbuff; } if (dd != null && dd.DrawIconsBar) { using (SolidBrush b = new SolidBrush(ColorTable.DropDownImageBg)) { e.Graphics.FillRectangle(b, imgsR); } using (Pen p = new Pen(ColorTable.DropDownImageSeparator)) { e.Graphics.DrawLine(p, new Point(imgsR.Right, imgsR.Top), new Point(imgsR.Right, imgsR.Bottom)); } } using (Pen p = new Pen(ColorTable.DropDownBorder)) { if (dd != null) { using (GraphicsPath r = RoundRectangle(new Rectangle(Point.Empty, new Size(dd.Size.Width -1 , dd.Size.Height -1)), dd.BorderRoundness)) { SmoothingMode smb = e.Graphics.SmoothingMode; e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.DrawPath(p, r); e.Graphics.SmoothingMode = smb; } } else { e.Graphics.DrawRectangle(p, outerR); } } if (dd.ShowSizingGrip) { Rectangle gripArea = Rectangle.FromLTRB( e.Bounds.Left + 1, e.Bounds.Bottom - dd.SizingGripHeight, e.Bounds.Right - 1, e.Bounds.Bottom - 1); using (LinearGradientBrush b = new LinearGradientBrush( gripArea, ColorTable.DropDownGripNorth, ColorTable.DropDownGripSouth, 90)) { e.Graphics.FillRectangle(b, gripArea); } using (Pen p = new Pen(ColorTable.DropDownGripBorder)) { e.Graphics.DrawLine(p, gripArea.Location, new Point(gripArea.Right - 1, gripArea.Top)); } DrawGripDot(e.Graphics, new Point(gripArea.Right - 7, gripArea.Bottom - 3)); DrawGripDot(e.Graphics, new Point(gripArea.Right - 3, gripArea.Bottom - 7)); DrawGripDot(e.Graphics, new Point(gripArea.Right - 3, gripArea.Bottom - 3)); } }
/// <summary> /// Renders the background of a dropdown /// </summary> /// <param name="e"></param> public virtual void OnRenderDropDownBackground(RibbonCanvasEventArgs e) { }
public override void OnRenderPanelPopupBackground(RibbonCanvasEventArgs e) { RibbonPanel pnl = e.RelatedObject as RibbonPanel; if (pnl == null) return; Rectangle darkBorder = Rectangle.FromLTRB( e.Bounds.Left, e.Bounds.Top, e.Bounds.Right, e.Bounds.Bottom); Rectangle lightBorder = Rectangle.FromLTRB( e.Bounds.Left + 1, e.Bounds.Top + 1, e.Bounds.Right - 1, e.Bounds.Bottom - 1); Rectangle textArea = Rectangle.FromLTRB( e.Bounds.Left + 1, pnl.ContentBounds.Bottom, e.Bounds.Right - 1, e.Bounds.Bottom - 1); GraphicsPath dark = RoundRectangle(darkBorder, 3); GraphicsPath light = RoundRectangle(lightBorder, 3); GraphicsPath txt = RoundRectangle(textArea, 3, Corners.SouthEast | Corners.SouthWest); using (Pen p = new Pen(ColorTable.PanelLightBorder)) { e.Graphics.DrawPath(p, light); } using (Pen p = new Pen(ColorTable.PanelDarkBorder)) { e.Graphics.DrawPath(p, dark); } using (SolidBrush b = new SolidBrush(ColorTable.PanelBackgroundSelected)) { e.Graphics.FillPath(b, light); } using (SolidBrush b = new SolidBrush(ColorTable.PanelTextBackground)) { e.Graphics.FillPath(b, txt); } txt.Dispose(); dark.Dispose(); light.Dispose(); }