コード例 #1
0
        void RenderArea(FormattedTextArea area, Rectangle rect)
        {
            if (area == null)
            {
                return;
            }

            TextArea textArea = area.TextArea;

            FillFormatRenderer fillFormatRenderer = new FillFormatRenderer((FillFormat)textArea.GetValue("FillFormat", GV.ReadOnly), _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), _gfx);

            lineFormatRenderer.Render(rect.X, rect.Y, rect.Width, rect.Height);
        }
コード例 #2
0
ファイル: ShapeRenderer.cs プロジェクト: dankennedy/MigraDoc
 internal ShapeRenderer(XGraphics gfx, Shape shape, FieldInfos fieldInfos)
     : base(gfx, shape, fieldInfos)
 {
     this.shape = shape;
       LineFormat lf = (LineFormat)this.shape.GetValue("LineFormat", GV.ReadOnly);
       this.lineFormatRenderer = new LineFormatRenderer(lf, gfx);
 }
コード例 #3
0
        internal ShapeRenderer(XGraphics gfx, Shape shape, FieldInfos fieldInfos)
            : base(gfx, shape, fieldInfos)
        {
            _shape = shape;
            LineFormat lf = (LineFormat)_shape.GetValue("LineFormat", GV.ReadOnly);

            _lineFormatRenderer = new LineFormatRenderer(lf, gfx);
        }
コード例 #4
0
ファイル: ShapeRenderer.cs プロジェクト: dankennedy/MigraDoc
 internal ShapeRenderer(XGraphics gfx, RenderInfo renderInfo, FieldInfos fieldInfos)
     : base(gfx, renderInfo, fieldInfos)
 {
     this.shape = (Shape)renderInfo.DocumentObject;
       LineFormat lf = (LineFormat)this.shape.GetValue("LineFormat", GV.ReadOnly);
       this.lineFormatRenderer = new LineFormatRenderer(lf, gfx);
       FillFormat ff = (FillFormat)this.shape.GetValue("FillFormat", GV.ReadOnly);
       this.fillFormatRenderer = new FillFormatRenderer(ff, gfx);
 }
コード例 #5
0
        internal ShapeRenderer(XGraphics gfx, RenderInfo renderInfo, FieldInfos fieldInfos)
            : base(gfx, renderInfo, fieldInfos)
        {
            _shape = (Shape)renderInfo.DocumentObject;
            LineFormat lf = (LineFormat)_shape.GetValue("LineFormat", GV.ReadOnly);

            _lineFormatRenderer = new LineFormatRenderer(lf, gfx);
            FillFormat ff = (FillFormat)_shape.GetValue("FillFormat", GV.ReadOnly);

            _fillFormatRenderer = new FillFormatRenderer(ff, gfx);
        }
コード例 #6
0
        Rectangle CalcContentRect()
        {
            LineFormatRenderer lfr = new LineFormatRenderer(_textframe.LineFormat, _gfx);
            XUnit lineWidth        = lfr.GetWidth();
            XUnit width;
            XUnit xOffset = lineWidth / 2;
            XUnit yOffset = lineWidth / 2;

            if (_textframe.Orientation == TextOrientation.Horizontal ||
                _textframe.Orientation == TextOrientation.HorizontalRotatedFarEast)
            {
                width    = _textframe.Width.Point;
                xOffset += _textframe.MarginLeft;
                yOffset += _textframe.MarginTop;
                width   -= xOffset;
                width   -= _textframe.MarginRight + lineWidth / 2;
            }
            else
            {
                width = _textframe.Height.Point;
                if (_textframe.Orientation == TextOrientation.Upward)
                {
                    xOffset += _textframe.MarginBottom;
                    yOffset += _textframe.MarginLeft;
                    width   -= xOffset;
                    width   -= _textframe.MarginTop + lineWidth / 2;
                }
                else
                {
                    xOffset += _textframe.MarginTop;
                    yOffset += _textframe.MarginRight;
                    width   -= xOffset;
                    width   -= _textframe.MarginBottom + lineWidth / 2;
                }
            }
            XUnit height = double.MaxValue;

            return(new Rectangle(xOffset, yOffset, width, height));
        }
コード例 #7
0
ファイル: ChartRenderer.cs プロジェクト: Sl0vi/MigraDoc
        void RenderArea(FormattedTextArea area, Rectangle rect)
        {
            if (area == null)
                return;

            TextArea textArea = area.TextArea;

            FillFormatRenderer fillFormatRenderer = new FillFormatRenderer((FillFormat)textArea.GetValue("FillFormat", GV.ReadOnly), _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), _gfx);
            lineFormatRenderer.Render(rect.X, rect.Y, rect.Width, rect.Height);
        }
コード例 #8
0
ファイル: FormattedTextFrame.cs プロジェクト: Sl0vi/MigraDoc
        Rectangle CalcContentRect()
        {
            LineFormatRenderer lfr = new LineFormatRenderer(_textframe.LineFormat, _gfx);
            XUnit lineWidth = lfr.GetWidth();
            XUnit width;
            XUnit xOffset = lineWidth / 2;
            XUnit yOffset = lineWidth / 2;

            if (_textframe.Orientation == TextOrientation.Horizontal ||
              _textframe.Orientation == TextOrientation.HorizontalRotatedFarEast)
            {
                width = _textframe.Width.Point;
                xOffset += _textframe.MarginLeft;
                yOffset += _textframe.MarginTop;
                width -= xOffset;
                width -= _textframe.MarginRight + lineWidth / 2;
            }
            else
            {
                width = _textframe.Height.Point;
                if (_textframe.Orientation == TextOrientation.Upward)
                {
                    xOffset += _textframe.MarginBottom;
                    yOffset += _textframe.MarginLeft;
                    width -= xOffset;
                    width -= _textframe.MarginTop + lineWidth / 2;
                }
                else
                {
                    xOffset += _textframe.MarginTop;
                    yOffset += _textframe.MarginRight;
                    width -= xOffset;
                    width -= _textframe.MarginBottom + lineWidth / 2;
                }
            }
            XUnit height = double.MaxValue;
            return new Rectangle(xOffset, yOffset, width, height);
        }