public IVisio.Shape AddShape(TextBlock block)
        {
            // Remember this Block
            this.Blocks.Add(block);

            // Calculate the Correct Full Rectangle
            var ll = new VA.Drawing.Point(this.InsertionPoint.X, this.InsertionPoint.Y - block.Size.Height);
            var tr = new VA.Drawing.Point(this.InsertionPoint.X + block.Size.Width, this.InsertionPoint.Y);
            var rect = new VA.Drawing.Rectangle(ll, tr);

            // Draw the Shape
            var newshape = this.page.DrawRectangle(rect);
            block.VisioShape = newshape;
            block.VisioShapeID = newshape.ID;
            block.Rectangle = rect;

            // Handle Text If Needed
            if (block.Text != null)
            {
                newshape.Text = block.Text;
            }

            this.AdjustInsertionPoint(block.Size);

            return newshape;
        }
        internal IVisio.Page Draw(FormRenderingContext ctx)
        {
            var r = new InteractiveRenderer(ctx.Document);
            var page_cells = new Pages.PageCells();
            this.VisioPage = r.CreatePage(this);
            ctx.Page = this.VisioPage;

            var titleblock = new TextBlock(new Drawing.Size(7.5, 0.5), this.Title);

            int _fontid = ctx.GetFontID(this.DefaultFont);
            titleblock.TextBlockCells.VerticalAlign = 0;
            titleblock.ParagraphCells.HorizontalAlign = 0;
            titleblock.FormatCells.LineWeight = 0;
            titleblock.FormatCells.LinePattern = 0;
            titleblock.CharacterCells.Font = _fontid;
            titleblock.CharacterCells.Size = get_pt_string(this.TitleTextSize);



            // Draw the shapes
            var titleshape = r.AddShape(titleblock);
            r.Linefeed();

            double body_height = r.GetDistanceToBottomMargin();
            var bodyblock = new TextBlock(new Drawing.Size(7.5, body_height), this.Body);
            bodyblock.ParagraphCells.HorizontalAlign = 0;
            bodyblock.ParagraphCells.SpacingAfter = get_pt_string(this.BodyParaSpacingAfter);
            bodyblock.CharacterCells.Font = _fontid;
            bodyblock.CharacterCells.Size = get_pt_string(this.BodyTextSize);
            bodyblock.FormatCells.LineWeight = 0;
            bodyblock.FormatCells.LinePattern = 0;
            bodyblock.TextBlockCells.VerticalAlign = 0;
            bodyblock.FormatCells.LineWeight = 0;
            bodyblock.FormatCells.LinePattern = 0;

            var bodyshape = r.AddShape(bodyblock);
            r.Linefeed();

            r.Finish();
            return this.VisioPage;
        }
 public TextBlock AddShape(double w, double h, string text)
 {
     var tb = new TextBlock(new VA.Drawing.Size(w, h), text);
     this.AddShape(tb);
     return tb;
 }