private void gddFont_Gallery_CustomDrawItemText(object sender, GalleryItemCustomDrawEventArgs e) { DevExpress.XtraBars.Ribbon.ViewInfo.GalleryItemViewInfo itemInfo = e.ItemInfo as DevExpress.XtraBars.Ribbon.ViewInfo.GalleryItemViewInfo; itemInfo.PaintAppearance.ItemDescription.DrawString(e.Cache, e.Item.Description, itemInfo.DescriptionBounds); AppearanceObject app = itemInfo.PaintAppearance.ItemCaption.Clone() as AppearanceObject; app.Font = (Font)e.Item.Tag; try { e.Cache.Graphics.DrawString(e.Item.Caption, app.Font, app.GetForeBrush(e.Cache), itemInfo.CaptionBounds); } catch { } e.Handled = true; }
protected override void DrawText(GraphicsCache cache) { string text = Text; if (text == null || text.Length == 0 || TextBounds.IsEmpty) { return; } AppearanceObject appearance = new AppearanceObject(GetDefaultAppearance()); appearance.Font = Owner.Font; appearance.TextOptions.Trimming = Trimming.EllipsisCharacter; Rectangle r = RectangleHelper.GetCenterBounds(TextBounds, new Size(TextBounds.Width, appearance.CalcDefaultTextSize(cache.Graphics).Height)); DrawTextShadow(cache, appearance, r); cache.DrawString(text, appearance.Font, appearance.GetForeBrush(cache), r, appearance.GetStringFormat()); }
protected override void DrawString(ControlGraphicsInfoArgs info, Rectangle bounds, string text, AppearanceObject appearance) { ButtonEditViewInfo vi = info.ViewInfo as ButtonEditViewInfo; int buttonsWidth = CalcButtonsWidth(info); int text_width = vi.Bounds.Width - buttonsWidth; if (text_width <= 1) { text_width = vi.ClientRect.Width; } bounds = new Rectangle(bounds.X, bounds.Y, text_width, bounds.Height); appearance.DrawString(info.Cache, text, bounds, appearance.GetForeBrush(info.Cache), appearance.GetTextOptions().GetStringFormat(info.ViewInfo.DefaultTextOptions)); }
protected void DrawClear(bool isHot, AppearanceObject app, GraphicsCache cache, Rectangle rect) { if (rect.IsEmpty) { return; } Brush br = app.GetForeBrush(cache); if (isHot) { SkinElementInfo skin = new SkinElementInfo(CommonSkins.GetSkin(DevExpress.LookAndFeel.UserLookAndFeel.Default.ActiveLookAndFeel)[CommonSkins.SkinHighlightedItem], rect); br = new SolidBrush(DevExpress.LookAndFeel.LookAndFeelHelper.GetSystemColor( DevExpress.LookAndFeel.UserLookAndFeel.Default.ActiveLookAndFeel, SystemColors.HotTrack)); ObjectPainter.DrawObject(cache, SkinElementPainter.Default, skin); } StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Center; cache.DrawString("Clear", app.Font, br, rect, format); }
protected override void DrawText(DevExpress.Utils.Drawing.GraphicsCache cache) { string text = Text; if (text == null || text.Length == 0 || TextBounds.IsEmpty) { return; } using (AppearanceObject appearance = new AppearanceObject(GetDefaultAppearance())) { appearance.TextOptions.Trimming = Trimming.EllipsisCharacter; appearance.TextOptions.HAlignment = HorzAlignment.Center; if (AllowHtmlDraw) { DrawHtmlText(cache, appearance); return; } Rectangle r = RectangleHelper.GetCenterBounds(TextBounds, new Size(TextBounds.Width, CalcTextHeight(cache.Graphics, appearance))); DrawTextShadow(cache, appearance, r); cache.DrawString(text, appearance.Font, appearance.GetForeBrush(cache), r, appearance.GetStringFormat()); } }