void RenderArea(FormattedTextArea area, Rectangle rect) { if (area == null) { return; } TextArea textArea = area.textArea; FillFormatRenderer fillFormatRenderer = new FillFormatRenderer((FillFormat)textArea.GetValue("FillFormat", GV.ReadOnly), this.gfx); fillFormatRenderer.Render(rect.X, rect.Y, rect.Width, rect.Height); XUnit top = rect.Y; top += textArea.TopPadding; XUnit bottom = rect.Y + rect.Height; bottom -= textArea.BottomPadding; top = AlignVertically(textArea.VerticalAlignment, top, bottom, area.ContentHeight); XUnit left = rect.X; left += textArea.LeftPadding; RenderInfo[] renderInfos = area.GetRenderInfos(); RenderByInfos(left, top, renderInfos); LineFormatRenderer lineFormatRenderer = new LineFormatRenderer((LineFormat)textArea.GetValue("LineFormat", GV.ReadOnly), this.gfx); lineFormatRenderer.Render(rect.X, rect.Y, rect.Width, rect.Height); }
Rectangle CalcContentRect() { LineFormatRenderer lfr = new LineFormatRenderer(this.textframe.LineFormat, this.gfx); XUnit lineWidth = lfr.GetWidth(); XUnit width; XUnit xOffset = lineWidth / 2; XUnit yOffset = lineWidth / 2; if (this.textframe.Orientation == TextOrientation.Horizontal || this.textframe.Orientation == TextOrientation.HorizontalRotatedFarEast) { width = this.textframe.Width.Point; xOffset += this.textframe.MarginLeft; yOffset += this.textframe.MarginTop; width -= xOffset; width -= this.textframe.MarginRight + lineWidth / 2; } else { width = this.textframe.Height.Point; if (this.textframe.Orientation == TextOrientation.Upward) { xOffset += this.textframe.MarginBottom; yOffset += this.textframe.MarginLeft; width -= xOffset; width -= this.textframe.MarginTop + lineWidth / 2; } else { xOffset += this.textframe.MarginTop; yOffset += this.textframe.MarginRight; width -= xOffset; width -= this.textframe.MarginBottom + lineWidth / 2; } } XUnit height = double.MaxValue; return(new Rectangle(xOffset, yOffset, width, height)); }