protected override void OnDestroyed() { if (layout != null) { layout.Dispose(); layout = null; } base.OnDestroyed(); }
internal protected override void OptionsChanged () { Pango.Layout layout = new Pango.Layout (Editor.PangoContext); layout.FontDescription = Editor.Options.Font; layout.SetText (string.Format ("0{0:X}", Data.Length) + "_"); int height; layout.GetPixelSize (out this.width, out height); layout.Dispose (); }
private void CreateLayout() { if (layout != null) { layout.Dispose(); } layout = new Pango.Layout(PangoContext); }
int StringHeight(Gtk.Widget w, string text) { int wi, he; Pango.Layout lo = w.CreatePangoLayout(text); lo.GetPixelSize(out wi, out he); lo.Dispose(); return(he); }
protected override void OnDestroyed() { if (textElements != null) { foreach (var textElement in textElements) { textElement.PerformPress -= PerformPress; } textElements = null; } if (layout != null) { layout.Dispose(); layout = null; } base.OnDestroyed(); }
public override void Dispose() { if (xLayout != null) { xLayout.Dispose(); } xLayout = null; base.Dispose(); }
public int ComputeRowHeight(Widget widget) { int lw, lh; Pango.Layout layout = new Pango.Layout (widget.PangoContext); layout.SetMarkup ("<big>W</big>"); layout.GetPixelSize (out lw, out lh); layout.Dispose (); return lh + 8; }
public Gdk.Rectangle RenderLayoutText(Context cr, string text, int x, int y, int width, int textHeight, Pango.Color color, Pango.Alignment align, Pango.EllipsizeMode ellipse) { if (string.IsNullOrEmpty(text)) { return(new Gdk.Rectangle()); } if (layout != null) { layout.Context.Dispose(); layout.FontDescription.Dispose(); layout.Dispose(); } layout = new Pango.Layout(ReferenceWidget.CreatePangoContext()); layout.FontDescription = new Pango.FontDescription(); layout.FontDescription.AbsoluteSize = Pango.Units.FromPixels(textHeight); layout.Width = Pango.Units.FromPixels(width); layout.Ellipsize = ellipse; layout.Alignment = align; if (ellipse == Pango.EllipsizeMode.None) { layout.Wrap = Pango.WrapMode.WordChar; } text = string.Format("<span foreground=\"{0}\">{1}</span>", color, text); layout.SetMarkup(text); cr.Rectangle(x, y, width, 155); cr.Clip(); cr.MoveTo(x, y); Pango.CairoHelper.ShowLayout(cr, layout); Pango.Rectangle strong, weak; layout.GetCursorPos(layout.Lines [layout.LineCount - 1].StartIndex + layout.Lines [layout.LineCount - 1].Length, out strong, out weak); cr.ResetClip(); return(new Gdk.Rectangle(Pango.Units.ToPixels(weak.X) + x, Pango.Units.ToPixels(weak.Y) + y, Pango.Units.ToPixels(weak.Width), Pango.Units.ToPixels(weak.Height))); }
internal protected override void OptionsChanged() { Pango.Layout layout = new Pango.Layout(Editor.PangoContext); layout.FontDescription = Editor.Options.Font; layout.SetText(string.Format("0{0:X}", Data.Length) + "_"); int height; layout.GetPixelSize(out this.width, out height); layout.Dispose(); }
internal static int ComputeRowHeight(Widget widget) { int w_width, row_height; Pango.Layout layout = new Pango.Layout(widget.PangoContext); layout.SetText("W"); layout.GetPixelSize(out w_width, out row_height); layout.Dispose(); return(row_height + 8); }
private int GetStringWidth(string str) { int width, height; Pango.Layout layout = new Pango.Layout(textview.PangoContext); layout.SetText(str); layout.GetPixelSize(out width, out height); layout.Dispose(); return(width); }
public int ComputeRowHeight(Widget widget) { int lw, lh; Pango.Layout layout = new Pango.Layout(widget.PangoContext); layout.SetMarkup("<big>W</big>"); layout.GetPixelSize(out lw, out lh); layout.Dispose(); return(lh + 8); }
private int ComputeWidgetHeight() { int width, height; Pango.Layout layout = new Pango.Layout(PangoContext); layout.SetText("W"); layout.GetPixelSize(out width, out height); layout.Dispose(); return(2 * height); }
protected override void OnDestroyed() { base.OnDestroyed(); if (titleLayout != null) { titleLayout.Dispose(); titleLayout = null; } }
private void CreateLayout() { if (layout != null) { layout.Dispose(); } layout = new Pango.Layout(PangoContext); layout.FontDescription = StyleContext.GetFont(StateFlags.Normal).Copy(); }
private void CreateLayout() { if (layout != null) { layout.Dispose(); } layout = new Pango.Layout(PangoContext); layout.Wrap = Pango.WrapMode.Word; }
int StringWidth(Gtk.Widget w, string text) { int wi, he; Pango.Layout lo = w.CreatePangoLayout(text); lo.FontDescription = w.Style.FontDesc; lo.GetPixelSize(out wi, out he); lo.Dispose(); return(wi); }
void DrawCursorLabel(ChartCursor cursor) { using (Gdk.GC gc = new Gdk.GC(GdkWindow)) { gc.RgbFgColor = cursor.Color; int x, y; GetPoint(cursor.Value, cursor.Value, out x, out y); if (cursor.Dimension == AxisDimension.X) { string text; if (cursor.LabelAxis != null) { double minStep = GetMinTickStep(cursor.Dimension); TickEnumerator tenum = cursor.LabelAxis.GetTickEnumerator(minStep); tenum.Init(cursor.Value); text = tenum.CurrentLabel; } else { text = GetValueLabel(cursor.Dimension, cursor.Value); } if (text != null && text.Length > 0) { Pango.Layout layout = new Pango.Layout(this.PangoContext); layout.FontDescription = IdeServices.FontService.SansFont.CopyModified(Ide.Gui.Styles.FontScale11); layout.SetMarkup(text); int tw, th; layout.GetPixelSize(out tw, out th); int tl = x - tw / 2; int tt = top + 4; if (tl + tw + 2 >= left + width) { tl = left + width - tw - 1; } if (tl < left + 1) { tl = left + 1; } GdkWindow.DrawRectangle(Style.WhiteGC, true, tl - 1, tt - 1, tw + 2, th + 2); GdkWindow.DrawRectangle(Style.BlackGC, false, tl - 2, tt - 2, tw + 3, th + 3); GdkWindow.DrawLayout(gc, tl, tt, layout); layout.Dispose(); } } else { throw new NotSupportedException(); } } }
internal protected override void OptionsChanged () { Pango.Layout layout = new Pango.Layout (Editor.PangoContext); layout.FontDescription = Editor.Options.Font; layout.SetText ("."); int height; layout.GetPixelSize (out charWidth, out height); layout.Dispose (); bgGC = GetGC (Style.HexDigitBg); fgGC = GetGC (Style.HexDigit); }
Pango.Layout EnsureLayout() { if (layout != null) { layout.Dispose(); } layout = null; if (text != null) { layout = CreatePangoLayout(""); //TODO: make this a property? var font = PropertyService.IsMac? "Lucida Grande 24" : "Sans 24"; layout.SetMarkup("<span font=\"" + font + "\">" + text + "</span>"); } return(layout); }
protected override void OnDestroyed() { RefreshGC(); if (layout != null) { layout.Dispose(); layout = null; } parent.StyleSet -= OnParentStyleSet; base.OnDestroyed(); }
public void RenderItem(Context cr, Gdk.Point renderAnchor, int width, Do.Universe.Item item, bool drawArrow) { cr.Rectangle(renderAnchor.X, renderAnchor.Y, width, Height); cr.SetSourceRGBA(0, 0, 0, 0); cr.Operator = Operator.Source; cr.Fill(); cr.Operator = Operator.Over; Gdk.Pixbuf pixbuf = IconProvider.PixbufFromIconName(item.Icon, IconSize); Gdk.CairoHelper.SetSourcePixbuf(cr, pixbuf, 2, 2); cr.Paint(); pixbuf.Dispose(); foreach (int i in parent.Secondary) { if (parent.Results[i] == item) { pixbuf = IconProvider.PixbufFromIconName("gtk-add", IconSize); Gdk.CairoHelper.SetSourcePixbuf(cr, pixbuf, 2, 2); cr.PaintWithAlpha(.7); pixbuf.Dispose(); } } Pango.Layout layout = new Pango.Layout(parent.PangoContext); layout.Width = Pango.Units.FromPixels(width - IconSize - 25); layout.Ellipsize = Pango.EllipsizeMode.End; layout.SetMarkup("<span foreground=\"#" + parent.ItemTextColor + "\">" + GLib.Markup.EscapeText(item.Name) + "</span>"); layout.FontDescription = Pango.FontDescription.FromString("normal bold"); layout.FontDescription.AbsoluteSize = Pango.Units.FromPixels(10); cr.MoveTo(IconSize + 6, 4); Pango.CairoHelper.ShowLayout(cr, layout); if (drawArrow) { cr.MoveTo(width - IconSize + 6, 5); cr.LineTo(width - IconSize + 10, 10); cr.LineTo(width - IconSize + 6, 15); cr.MoveTo(width - IconSize + 2, 5); cr.LineTo(width - IconSize + 6, 10); cr.LineTo(width - IconSize + 2, 15); Gdk.Color gc = new Gdk.Color(); Gdk.Color.Parse("#" + parent.ItemTextColor, ref gc); cr.SetSourceRGB(gc); cr.Stroke(); } layout.FontDescription.Dispose(); layout.Dispose(); (cr as IDisposable).Dispose(); }
internal void InitSize() { Pango.Layout la = CreateSizedLayout(); la.SetText("H"); int w, h; la.GetPixelSize(out w, out h); totalHeight = h + TopPadding + BottomPadding; la.Dispose(); }
private void BuildLayouts() { if (layout != null) { layout.Dispose(); } layout = new Pango.Layout(PangoContext); layout.FontDescription = PangoContext.FontDescription; layout.Ellipsize = Pango.EllipsizeMode.None; }
internal protected override void OptionsChanged() { Pango.Layout layout = new Pango.Layout(Editor.PangoContext); layout.FontDescription = Editor.Options.Font; layout.SetText("."); int height; layout.GetPixelSize(out charWidth, out height); layout.Dispose(); bgGC = GetGC(Style.HexDigitBg); fgGC = GetGC(Style.HexDigit); }
protected override void Dispose(bool disposing) { if (disposing) { if (measureLayout != null) { measureLayout.Dispose(); measureLayout = null; } } base.Dispose(disposing); }
public void Dispose() { if (g != null) { g.Dispose(); } if (layout != null) { layout.Dispose(); } }
protected override void Dispose(bool disposing) { if (disposing) { if (layout != null) { layout.Dispose(); } layout = null; } base.Dispose(disposing); }
protected override void OnDestroyed() { base.OnDestroyed(); // widget.Document.Saved -= UpdateAnnotations; widget.Editor.Document.TextReplacing -= EditorDocumentTextReplacing; widget.Editor.Document.LineChanged -= EditorDocumentLineChanged; if (layout != null) { layout.Dispose(); layout = null; } }
private void RenderLabels(Context cr) { if (segments.Count == 0) { return; } Pango.Layout layout = null; Gdk.RGBA rgba = StyleContext.GetColor(StateFlags); Color text_color = CairoExtensions.GdkRGBAToCairoColor(rgba); Color box_stroke_color = new Color(0, 0, 0, 0.6); int x = 0; foreach (Segment segment in segments) { cr.LineWidth = 1; cr.Rectangle(x + 0.5, 2 + 0.5, segment_box_size - 1, segment_box_size - 1); using (var grad = MakeSegmentGradient(segment_box_size, segment.Color, true)) { cr.SetSource(grad); cr.FillPreserve(); cr.SetSourceColor(box_stroke_color); cr.Stroke(); } x += segment_box_size + segment_box_spacing; int lw, lh; layout = CreateAdaptLayout(layout, false, true); layout.SetText(FormatSegmentText(segment)); layout.GetPixelSize(out lw, out lh); cr.MoveTo(x, 0); text_color.A = 0.9; cr.SetSourceColor(text_color); Pango.CairoHelper.ShowLayout(cr, layout); cr.Fill(); layout = CreateAdaptLayout(layout, true, false); layout.SetText(FormatSegmentValue(segment)); cr.MoveTo(x, lh); text_color.A = 0.75; cr.SetSourceColor(text_color); Pango.CairoHelper.ShowLayout(cr, layout); cr.Fill(); x += segment.LayoutWidth + segment_label_spacing; } layout.Dispose(); }
/// <summary> /// Renders the pager text using the results of SetupPagerText. /// </summary> protected virtual void RenderPagerText(Cairo.Context context, Pango.Layout layout, Gdk.Rectangle bounds) { int w, h; layout.GetPixelSize(out w, out h); context.MoveTo(bounds.X + (bounds.Width - w) / 2, bounds.Y + (bounds.Height - h) / 2); context.SetSourceColor(PagerTextColor); Pango.CairoHelper.ShowLayout(context, layout); layout.Dispose(); }
public void Dispose() { if (layout != null) { layout.Dispose(); layout = null; } if (attributes != null) { attributes.Dispose(); attributes = null; } }
public void Dispose() { if (Accessible != null) { Accessible.PerformPress -= OnTabPressed; Accessible = null; } if (layout != null) { layout.Dispose(); } }
internal protected override void OptionsChanged () { backgroundGC = GetGC (Style.IconBarBg); separatorGC = GetGC (Style.IconBarSeperator); Pango.Layout layout = new Pango.Layout (Editor.PangoContext); layout.FontDescription = Editor.Options.Font; layout.SetText ("!"); int tmp; layout.GetPixelSize (out tmp, out this.marginWidth); marginWidth *= 12; marginWidth /= 10; layout.Dispose (); }
protected override void Render (Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags) { try{ Gdk.Rectangle text_area1 = new Gdk.Rectangle(); Gdk.Rectangle text_area2 = new Gdk.Rectangle(); Gdk.Rectangle text_area3 = new Gdk.Rectangle(); text_area1.Y= cell_area.Y; text_area2.Y= cell_area.Y+33; text_area3.X = cell_area.Width-20; text_area3.Y= cell_area.Y+33; text_area3.Width = 75; Pango.Layout text_l1 = new Pango.Layout(widget.PangoContext); text_l1.FontDescription = Pango.FontDescription.FromString ("Meiryo,Arial 10.5"); text_l1.SetText(text1); Pango.Layout text_l2 = new Pango.Layout(widget.PangoContext); text_l2.FontDescription = Pango.FontDescription.FromString ("Meiryo,MS Gothic,Arial 8"); text_l2.SetText(text2); text_l2.Alignment = Pango.Alignment.Right; Pango.Layout text_l3 = new Pango.Layout(widget.PangoContext); text_l3.Width = Pango.Units.FromPixels(text_area3.Width); text_l3.FontDescription = Pango.FontDescription.FromString ("Meiryo,MS Gothic,Arial 8"); text_l3.Alignment = Pango.Alignment.Right; text_l3.SetText(text3); text_l2.Width = Pango.Units.FromPixels(cell_area.Width-text_l3.Text.Length*8-13); StateType state = flags.HasFlag(CellRendererState.Selected) ? widget.IsFocus ? StateType.Selected : StateType.Active : StateType.Normal; text_l3.SetMarkup("<span color=" + (char)34 + "grey" + (char)34 + ">" + text_l3.Text + "</span>");; window.DrawLayout(widget.Style.TextGC(state), 55, text_area1.Y, text_l1); window.DrawLayout(widget.Style.TextGC(state), 55, text_area2.Y, text_l2); window.DrawLayout(widget.Style.TextGC(state), text_area3.X, text_area3.Y, text_l3); text_l1.Dispose (); text_l2.Dispose (); text_l3.Dispose (); }catch(Exception e){ Console.WriteLine (e); } }
protected override bool OnExposeEvent (Gdk.EventExpose evnt) { Pango.Layout la = new Pango.Layout (PangoContext); int w, h; if (UseMarkup) la.SetMarkup (Text); else la.SetText (Text); la.GetPixelSize (out w, out h); int tx = Allocation.X + (int) Xpad + (int) ((float)(Allocation.Width - (int)(Xpad*2) - w) * Xalign); int ty = Allocation.Y + (int) Ypad + (int) ((float)(Allocation.Height - (int)(Ypad*2) - h) * Yalign); using (var ctx = CairoHelper.Create (evnt.Window)) { ctx.SetSourceColor (Style.Text (State).ToCairoColor ()); ctx.MoveTo (tx, ty); // In order to get the same result as in MonoDevelop.Components.DockNotebook.TabStrip.DrawTab() // (document tabs) we need to draw using a LinearGradient (because of issues below), // but we don't want to mask the actual text here, like in the doc tabs. // Therefore we use a LinearGradient and mask only the last vertical pixel line // of the label with 0.99 alpha, which forces Cairo to render the whole layout // in the desired way. // Semi-transparent gradient disables sub-pixel rendering of the label (reverting to grayscale antialiasing). // As Mac sub-pixel font rendering looks stronger than grayscale rendering, the label used in pad tabs // looked different. We need to simulate same gradient treatment as we have in document tabs. using (var lg = new LinearGradient (tx + w - 1, 0, tx + w, 0)) { var color = Style.Text (State).ToCairoColor (); lg.AddColorStop (0, color); color.A = 0.99; lg.AddColorStop (1, color); ctx.SetSource (lg); Pango.CairoHelper.ShowLayout (ctx, la); } } la.Dispose (); return true; }
internal protected override void OptionsChanged () { Pango.Layout layout = new Pango.Layout (Editor.PangoContext); layout.FontDescription = Editor.Options.Font; string groupString = new string ('0', Editor.Options.GroupBytes * 2); layout.SetText (groupString + " "); int lineHeight; layout.GetPixelSize (out groupWidth, out lineHeight); Data.LineHeight = lineHeight; layout.SetText ("00"); layout.GetPixelSize (out byteWidth, out lineHeight); layout.Dispose (); tabArray = new Pango.TabArray (1, true); tabArray.SetTab (0, Pango.TabAlign.Left, groupWidth); bgGC = GetGC (Style.HexDigitBg); fgGC = GetGC (Style.HexDigit); }
protected override bool OnExposeEvent (Gdk.EventExpose evnt) { if (!dropShadowVisible) return base.OnExposeEvent (evnt); Pango.Layout la = new Pango.Layout (PangoContext); int w, h; if (UseMarkup) la.SetMarkup (Text); else la.SetText (Text); la.GetPixelSize (out w, out h); int tx = Allocation.X + (int) Xpad + (int) ((float)(Allocation.Width - (int)(Xpad*2) - w) * Xalign); int ty = Allocation.Y + (int) Ypad + (int) ((float)(Allocation.Height - (int)(Ypad*2) - h) * Yalign); GdkWindow.DrawLayout (Style.TextGC (State), tx, ty, la); la.Dispose (); return true; }
public override int ComputeRowHeight (Widget widget) { int height; int text_w, text_h; Pango.Layout layout = new Pango.Layout (widget.PangoContext); layout.FontDescription = widget.PangoContext.FontDescription; layout.FontDescription.Weight = Pango.Weight.Bold; layout.SetText ("W"); layout.GetPixelSize (out text_w, out text_h); height = text_h; layout.FontDescription.Weight = Pango.Weight.Normal; layout.FontDescription.Size = (int)(layout.FontDescription.Size * Pango.Scale.Small); layout.FontDescription.Style = Pango.Style.Italic; layout.SetText ("W"); layout.GetPixelSize (out text_w, out text_h); height += text_h; layout.Dispose (); return (height < image_size ? image_size : height) + 6; }
private int ComputeWidgetHeight() { int width, height; Pango.Layout layout = new Pango.Layout (PangoContext); layout.SetText ("W"); layout.GetPixelSize (out width, out height); layout.Dispose (); return 2 * height; }
int GetStringWidth (string str) { int width, height; var layout = new Pango.Layout (textview.PangoContext); layout.SetText (str); layout.GetPixelSize (out width, out height); layout.Dispose (); return width; }
void DrawText(Gdk.Window window, Cairo.Context cr, string text) { bool theme; Gdk.GC light; const int marginx = 10; int winWidth, winHeight, w, h; window.GetSize (out winWidth, out winHeight); if (project != null && project.Details.Theme != null) { theme = true; } else theme = false; if (theme == true) { if (winWidth > project.Details.Width) winWidth = project.Details.Width; if (winHeight > project.Details.Height) winHeight = project.Details.Height; } Pango.Layout layout = new Pango.Layout (this.PangoContext); layout.Width = winWidth * (int) Pango.Scale.PangoScale; layout.SetMarkup (text); layout.GetPixelSize (out w, out h); if (theme) { // TODO: We should force the ink colour too cr.Color = new Cairo.Color (0, 0, 0, 0.7); cr.Rectangle (((winWidth - w) /2) - marginx, (winHeight / 2), w + marginx * 2, h * 2); cr.Fill (); cr.Stroke (); light = Style.LightGC (StateType.Normal); } light = Style.DarkGC (StateType.Normal); window.DrawLayout (light, (winWidth - w) /2, (winHeight / 2) + 4, layout); layout.Dispose (); }
internal static int ComputeRowHeight(Widget widget) { int w_width, row_height; Pango.Layout layout = new Pango.Layout (widget.PangoContext); layout.SetText ("W"); layout.GetPixelSize (out w_width, out row_height); layout.Dispose (); return row_height + 8; }
void MeasureHeight(IEnumerable<TableRow> rowList, ref int y) { heightMeasured = true; Pango.Layout layout = new Pango.Layout (PangoContext); foreach (var r in rowList) { layout.SetText (r.Label); int w,h; layout.GetPixelSize (out w, out h); if (r.IsCategory) { r.EditorBounds = new Gdk.Rectangle (0, y, Allocation.Width, h + CategoryTopBottomPadding * 2); y += h + CategoryTopBottomPadding * 2; } else { int eh; int dividerX = (int)((double)Allocation.Width * dividerPosition); var cell = GetCell (r); cell.GetSize (Allocation.Width - dividerX, out w, out eh); eh = Math.Max (h + PropertyTopBottomPadding * 2, eh); r.EditorBounds = new Gdk.Rectangle (dividerX + PropertyContentLeftPadding, y, Allocation.Width - dividerX - PropertyContentLeftPadding, eh); y += eh; } if (r.ChildRows != null && (r.Expanded || r.AnimatingExpand)) { int py = y; MeasureHeight (r.ChildRows, ref y); r.ChildrenHeight = y - py; if (r.AnimatingExpand) y = py + r.AnimationHeight; } } layout.Dispose (); }
void DrawString (string text, bool isMarkup, Cairo.Context context, int x, int y, int width, double opacity, Pango.Context pango, StatusArea.RenderArg arg) { Pango.Layout pl = new Pango.Layout (pango); if (isMarkup) pl.SetMarkup (text); else pl.SetText (text); pl.FontDescription = Styles.StatusFont; pl.FontDescription.AbsoluteSize = Pango.Units.FromPixels (Styles.StatusFontPixelHeight); pl.Ellipsize = Pango.EllipsizeMode.End; pl.Width = Pango.Units.FromPixels(width); int w, h; pl.GetPixelSize (out w, out h); context.Save (); // use widget height instead of message box height as message box does not have a true height when no widgets are packed in it // also ensures animations work properly instead of getting clipped context.Rectangle (new Rectangle (x, arg.Allocation.Y, width, arg.Allocation.Height)); context.Clip (); // Subtract off remainder instead of drop to prefer higher centering when centering an odd number of pixels context.MoveTo (x, y - h / 2 - (h % 2)); context.Color = Styles.WithAlpha (FontColor (), opacity); Pango.CairoHelper.ShowLayout (context, pl); pl.Dispose (); context.Restore (); }
public override void GetSize(Gtk.Widget widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height) { if(_ImageRow) { width = (int) this.Xpad * 2 + _pixbuf.Width; height = (int) this.Ypad * 2 + _pixbuf.Height; } else { int IconW, IconH; Icon.SizeLookup (_IconsSize, out IconW, out IconH); Pango.Layout Layout = new Pango.Layout (widget.PangoContext); Layout.FontDescription = _font; Layout.SetMarkup (_Text); int layoutWidth, layoutHeight; Layout.GetPixelSize (out layoutWidth, out layoutHeight); Layout.Dispose (); width = (int) this.Xpad * 2 + IconW + 5 + layoutWidth; height = (int) this.Ypad * 2 + Math.Max ( IconH, layoutHeight); } if (cell_area != Gdk.Rectangle.Zero) { if (widget.Direction == Gtk.TextDirection.Rtl) x_offset = (int) ((1.0 - this.Xalign) * (cell_area.Width - width)); else x_offset = (int) (this.Xalign * (cell_area.Width - width)); x_offset = System.Math.Max (x_offset, 0); y_offset = (int) (this.Yalign * (cell_area.Height - height)); y_offset = System.Math.Max (y_offset, 0); } else { x_offset = 0; y_offset = 0; } }