SyntaxDrawer(IGraphTarget target)
        {
            _stringFormat = new StringFormat(StringFormatFlags.NoWrap);
            _font = new Font(FontFamily.Families.Single(f1 => f1.Name == "Arial"), 10);
            _lineBrush = new SolidBrush(Color.Black);
            _linePen = new Pen(_lineBrush, 1);
            _nodeBrush = new SolidBrush(Color.LightBlue);
            _graphics = System.Drawing.Graphics.FromImage(new Bitmap(1, 1));
            _sizeBase = (_font.Height * 8) / 10;

            _syntax = Syntax.Create(target, this);
            var width = _syntax.Width + _sizeBase + 1;
            var height = _syntax.Height + _sizeBase + 1;
            _bitmap = new Bitmap(width, height);
            _graphics = System.Drawing.Graphics.FromImage(_bitmap);
            var frame = new Rectangle(0, 0, width, height);
            _graphics.FillRectangle(new SolidBrush(Color.Transparent), frame);
            _graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
        }
Example #2
0
 static int SaveHeight(Syntax syntax) { return syntax == null ? 0 : syntax.Height; }
Example #3
0
 static int SaveAnchorWidth(Syntax syntax) { return syntax == null ? 0 : syntax.Anchor.Width; }
Example #4
0
 static int SaveWidth(Syntax syntax) { return syntax == null ? 0 : syntax.Width; }