예제 #1
0
    public void DrawCellString(string s, CellTextHorizontalAlignment HorizontalAlignment, CellTextVerticalAlignment VerticalAlignment, Rectangle BoundingRect, bool DrawRectangle, Graphics Target, Font PrintFont, Brush FillColour)
    {
        float x = 0;
        float y = 0;

        if (DrawRectangle)
        {
            Target.FillRectangle(FillColour, BoundingRect);
            Target.DrawRectangle(_GridPen, BoundingRect);
        }

        //\\ Set the text alignment
        if (HorizontalAlignment == CellTextHorizontalAlignment.LeftAlign)
        {
            _Textlayout.Alignment = StringAlignment.Near;
        }
        else if (HorizontalAlignment == CellTextHorizontalAlignment.RightAlign)
        {
            _Textlayout.Alignment = StringAlignment.Far;
        }
        else
        {
            _Textlayout.Alignment = StringAlignment.Center;
        }

        RectangleF BoundingRectF = new RectangleF(BoundingRect.X + _CellGutter, BoundingRect.Y + _CellGutter, BoundingRect.Width - (2 * _CellGutter), BoundingRect.Height - (2 * _CellGutter));

        Target.DrawString(s, PrintFont, System.Drawing.Brushes.Black, BoundingRectF, _Textlayout);
    }
예제 #2
0
    public void DrawCellString(string s, CellTextHorizontalAlignment HorizontalAlignment, CellTextVerticalAlignment VerticalAlignment, Rectangle BoundingRect, bool DrawRectangle, Graphics Target, Font PrintFont, Brush FillColour)
    {
        float x = 0;
        float y = 0;

        if (DrawRectangle) {
            Target.FillRectangle(FillColour, BoundingRect);
            Target.DrawRectangle(_GridPen, BoundingRect);
        }

        //\\ Set the text alignment
        if (HorizontalAlignment == CellTextHorizontalAlignment.LeftAlign) {
            _Textlayout.Alignment = StringAlignment.Near;
        }
        else if (HorizontalAlignment == CellTextHorizontalAlignment.RightAlign) {
            _Textlayout.Alignment = StringAlignment.Far;
        }
        else {
            _Textlayout.Alignment = StringAlignment.Center;
        }

        RectangleF BoundingRectF = new RectangleF(BoundingRect.X + _CellGutter, BoundingRect.Y + _CellGutter, BoundingRect.Width - (2 * _CellGutter), BoundingRect.Height - (2 * _CellGutter));

        Target.DrawString(s, PrintFont, System.Drawing.Brushes.Black, BoundingRectF, _Textlayout);
    }