public override void OnRenderPanelPopupBackground(RibbonCanvasEventArgs e) { var pnl = e.RelatedObject as RibbonPanel; if (pnl == null) return; var darkBorder = Rectangle.FromLTRB( e.Bounds.Left, e.Bounds.Top, e.Bounds.Right, e.Bounds.Bottom); var lightBorder = Rectangle.FromLTRB( e.Bounds.Left + 1, e.Bounds.Top + 1, e.Bounds.Right - 1, e.Bounds.Bottom - 1); var textArea = Rectangle.FromLTRB( e.Bounds.Left + 1, pnl.ContentBounds.Bottom, e.Bounds.Right - 1, e.Bounds.Bottom - 1); var dark = RoundRectangle(darkBorder, 3); var light = RoundRectangle(lightBorder, 3); var txt = RoundRectangle(textArea, 3, Corners.SouthEast | Corners.SouthWest); using (var p = new Pen(ColorTable.PanelLightBorder)) { e.Graphics.DrawPath(p, light); } using (var p = new Pen(ColorTable.PanelDarkBorder)) { e.Graphics.DrawPath(p, dark); } using (var b = new SolidBrush(ColorTable.PanelBackgroundSelected)) { e.Graphics.FillPath(b, light); } using (var b = new SolidBrush(ColorTable.PanelTextBackground)) { e.Graphics.FillPath(b, txt); } txt.Dispose(); dark.Dispose(); light.Dispose(); }
/// <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) { var outerR = new Rectangle(0, 0, e.Bounds.Width - 1, e.Bounds.Height - 1); var imgsR = new Rectangle(0, 0, 26, e.Bounds.Height); var dd = e.Canvas as RibbonDropDown; using (var b = new SolidBrush(ColorTable.DropDownBg)) { e.Graphics.FillRectangle(b, outerR); } using (var b = new SolidBrush(ColorTable.DropDownImageBg)) { e.Graphics.FillRectangle(b, imgsR); } using (var p = new Pen(ColorTable.DropDownImageSeparator)) { e.Graphics.DrawLine(p, new Point(imgsR.Right, imgsR.Top), new Point(imgsR.Right, imgsR.Bottom)); } using (var p = new Pen(ColorTable.DropDownBorder)) { e.Graphics.DrawRectangle(p, outerR); } if (dd.ShowSizingGrip) { var gripArea = Rectangle.FromLTRB( e.Bounds.Left + 1, e.Bounds.Bottom - dd.SizingGripHeight, e.Bounds.Right - 1, e.Bounds.Bottom - 1); if (gripArea.Width == 0) { return; } using (var b = new LinearGradientBrush( gripArea, ColorTable.DropDownGripNorth, ColorTable.DropDownGripSouth, 90)) { e.Graphics.FillRectangle(b, gripArea); } using (var 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) { }