예제 #1
0
        private void RenderText(Graphics g, GridPanel panel,
            GridColumn column, CellVisualStyle style, Rectangle bounds)
        {
            string s = column.GetHeaderText();

            if (s != null)
            {
                if (_MouseDownButtons == MouseButtons.Left)
                {
                    if (panel.ColumnHeaderClickBehavior == ColumnHeaderClickBehavior.SortAndReorder)
                    {
                        if (_Reordering == false && column == _MouseDownHitColumn &&
                            _MouseDownHitArea == HeaderArea.InContent)
                        {
                            bounds.X++;
                            bounds.Y += 2;
                            bounds.Height -= 2;
                        }
                    }
                }

                bounds.Width--;
                bounds.Height--;

                if (column.HeaderTextMarkup != null)
                {
                    RenderTextMarkup(g, column.HeaderTextMarkup, style, bounds);
                }
                else
                {
                    eTextFormat tf = style.GetTextFormatFlags();

                    TextDrawing.DrawString(g, s, style.Font, style.TextColor, bounds, tf);
                }
            }
        }
예제 #2
0
        private Size MeasureHeaderText(Graphics g,
            GridColumn column, CellVisualStyle style, Size constraintSize)
        {
            Size size = Size.Empty;

            string s = column.GetHeaderText();

            if (string.IsNullOrEmpty(s) == false)
            {
                if (column.HeaderTextMarkup != null)
                {
                    size = GetMarkupTextSize(g,
                        column.HeaderTextMarkup, style, constraintSize.Width);

                    column.HeaderTextSize = size;
                }
                else
                {
                    eTextFormat tf = style.GetTextFormatFlags();

                    size = (constraintSize.IsEmpty == true)
                               ? TextHelper.MeasureText(g, s, style.Font)
                               : TextHelper.MeasureText(g, s, style.Font, constraintSize, tf);
                }
            }

            return (size);
        }