/// <summary> /// Renders the text of the item specified on the event /// </summary> /// <param name="e">Event data and paint tools</param> public virtual void OnRenderRibbonItemText(RibbonTextEventArgs e) { }
public override void OnRenderRibbonItemText(RibbonTextEventArgs e) { Color foreColor = e.Color; StringFormat sf = e.Format; Font f = e.Ribbon.Font; bool embedded = false; if (e.Item is RibbonButton) { #region Button RibbonButton b = e.Item as RibbonButton; if (b is RibbonCaptionButton) { if(WinApi.IsWindows) f = new Font("Marlett", f.Size); embedded = true; foreColor = ColorTable.Arrow; } if (b.Style == RibbonButtonStyle.DropDown && b.SizeMode == RibbonElementSizeMode.Large) { DrawButtonDropDownArrow(e.Graphics, b, e.Bounds); } #endregion } else if (e.Item is RibbonSeparator) { foreColor = GetTextColor(e.Item.Enabled); } embedded = embedded || !e.Item.Enabled; if (embedded) { Rectangle cbr = e.Bounds; cbr.Y++; using (SolidBrush b = new SolidBrush(ColorTable.ArrowLight)) { e.Graphics.DrawString(e.Text, new Font(f, e.Style), b, cbr, sf); } } if (foreColor.Equals(Color.Empty)) { foreColor = GetTextColor(e.Item.Enabled); } using (SolidBrush b = new SolidBrush(foreColor)) { e.Graphics.DrawString(e.Text, new Font(f, e.Style), b, e.Bounds, sf); } }