Example #1
0
        internal virtual Size_ InternalGetPreferredSize(Size_ proposed)
        {
            Size_ size;

            if (Text == string.Empty)
            {
                size = new Size_(0, Font.Height);
            }
            else
            {
                size        = Size_.Ceiling(TextRenderer.MeasureString(Text, Font, req_witdthsize, string_format));
                size.Width += 3;
            }

            size.Width  += Padding.Horizontal;
            size.Height += Padding.Vertical;

            if (!use_compatible_text_rendering)
            {
                return(size);
            }

            if (border_style == BorderStyle.None)
            {
                size.Height += 3;
            }
            else
            {
                size.Height += 6;
            }

            return(size);
        }
Example #2
0
        protected internal override Size_ GetPreferredSize(Graphics g, object value)
        {
            string text = GetFormattedValue(value);
            Size_  s    = Size_.Ceiling(g.MeasureString(text, this.DataGridTableStyle.DataGrid.Font));

            s.Width += 4;
            return(s);
        }