Exemplo n.º 1
0
        protected override void OnDraw(Graphics g, Font font, Style style)
        {
            VectorGraphics.DrawSquareBracket(new RectangleF(Left + 3, Top, Width - 6, Height), g, Brushes.Black);

            SizeF bracketSize   = g.MeasureString("[", font);
            SizeF separatorSize = g.MeasureString(",", font);


            float baseLine = Top + Height - maxBottom;

            float x = Left + bracketSize.Width;


            int index = 0;

            foreach (Expression item in Items)
            {
                item.Draw(g, font, style);

                x += item.DesiredWidth;

                if (index < Items.Length - 1)
                {
                    g.DrawString(",", font, Brushes.Black, x, baseLine - separatorSize.Height / 2);
                    x += separatorSize.Width;
                }


                index++;
            }
        }
Exemplo n.º 2
0
        protected override void OnDraw(Graphics g, Font font, Style style)
        {
            VectorGraphics.DrawSquareBracket(new RectangleF(Left, Top, Width, Height), g, Brushes.Black);

            Pen p = new Pen(Brushes.LightGray);

            p.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;

            int rowCount    = Rows.Length;
            int columnCount = Rows[0].Length;

            float spacing = 10;

            float y = Top + spacing;

            for (int row = 0; row <= rowCount - 1; row++)
            {
                float x = Left + spacing;

                for (int column = 0; column <= columnCount - 1; column++)
                {
                    Expression item = Rows[row][column];
                    item.Draw(g, font, style);

                    g.DrawRectangle(p, x, y, maxCellWidth[column], maxCellTopHeight[row] + maxCellBottomHeight[row]);

                    x += maxCellWidth[column] + spacing;
                }

                y += maxCellTopHeight[row] + maxCellBottomHeight[row] + spacing;
            }

            p.Dispose();
        }