Example #1
0
        protected void RenderRowText(Graphics g,
            TextRowVisualStyle style, Rectangle r)
        {
            string s = _Text;

            if (string.IsNullOrEmpty(s) == false)
            {
                if (r.Width > 0 && r.Height > 0)
                {
                    if (_TextMarkup != null)
                    {
                        RenderTextMarkup(g, style, r);
                    }
                    else
                    {
                        eTextFormat tf = style.GetTextFormatFlags();

                        TextDrawing.DrawString(g, s, style.Font, style.TextColor, r, tf);
                    }
                }
            }
        }
Example #2
0
        private Size GetTextSize(
            GridLayoutInfo layoutInfo, TextRowVisualStyle style, int width)
        {
            Size size = Size.Empty;

            if (string.IsNullOrEmpty(_Text) == false)
            {
                if (_TextMarkup != null)
                {
                    size = GetMarkupTextSize(layoutInfo, style, width);
                }
                else
                {
                    eTextFormat tf = style.GetTextFormatFlags();

                    if (width <= 0)
                    {
                        if (style.AllowWrap == Tbool.True)
                            tf &= ~eTextFormat.WordBreak;
                    }

                    size = TextHelper.MeasureText(
                        layoutInfo.Graphics, _Text, style.Font, new Size(width, 0), tf);
                }
            }

            return (size);
        }