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 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()); } }
protected virtual void UpdateAlignment(ButtonsPanelInfo viewInfo) { if (viewInfo.ButtonsInfo.Count == 0 || viewInfo.Height < 1) { return; } var delta = Point.Empty; if (viewInfo.Width < viewInfo.Bounds.Width) { if (HAlignment == HorzAlignment.Center) { delta.X = RectangleHelper.GetCenterBounds(viewInfo.Bounds, new Size(viewInfo.Width, 1)).X - viewInfo.Bounds.X; } if (HAlignment == HorzAlignment.Far) { delta.X = viewInfo.Bounds.Width - viewInfo.Width; } } if (viewInfo.Height < viewInfo.Bounds.Height) { if (VAlignment == VertAlignment.Center) { delta.Y = RectangleHelper.GetCenterBounds(viewInfo.Bounds, new Size(1, viewInfo.Height)).Y - viewInfo.Bounds.Y; } if (VAlignment == VertAlignment.Bottom) { delta.Y = viewInfo.Bounds.Height - viewInfo.Height; } } if (!delta.IsEmpty) { foreach (var b in viewInfo.ButtonsInfo) { b.OffsetContent(delta.X, delta.Y); } } }