在百度SO任何一个控件名都会有好多结果,呵呵 
 
其实我的意思很明确,就是不做单一的组件,要做就做成套的,我的最新版皮肤里已加都加入了你说的这些功能,只是需要和皮肤一起使用,没有想过要单独出来。因为我认为成套的控件,应该会比单一的控件更实用。 
再说如果你想单一的实现那就简单多了, 
继承DataGridView,添加表头信息类。 
  2,添加CellPainting,代码如下:[C#] 纯文本查看 复制代码 private void DataGridViewEx_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
    if (e.RowIndex == -1)
    {
        //   int w = dataGridView1.HorizontalScrollingOffset + dataGridView1.TopLeftHeaderCell.Size.Width + dataGridView1.Columns[0].Width + 10;
        Rectangle newRect = new Rectangle(e.CellBounds.X + 1,
        e.CellBounds.Y + 1, e.CellBounds.Width - 4,
        e.CellBounds.Height - 4);
        using (
            Brush gridBrush = new SolidBrush(this.GridColor),
            backColorBrush = new SolidBrush(e.CellStyle.BackColor))
        {
            using (Pen gridLinePen = new Pen(gridBrush))
            {
                // Erase the cell.
                e.Graphics.FillRectangle(backColorBrush, e.CellBounds);
                // Draw the grid lines (only the right and bottom lines;
                // DataGridView takes care of the others).
                e.Graphics.DrawLine(gridLinePen, e.CellBounds.Left,
                    e.CellBounds.Bottom - 1, e.CellBounds.Right - 1,
                    e.CellBounds.Bottom - 1);
                if (e.ColumnIndex > -1 && topRow != null && topRow.Cells[e.ColumnIndex].ColSpan > 1)
                {
                    e.Graphics.DrawLine(gridLinePen, e.CellBounds.Right - 1,
                        e.CellBounds.Top + e.ClipBounds.Height / 2, e.CellBounds.Right - 1,
                        e.CellBounds.Bottom);
                }
                else
                {
                    e.Graphics.DrawLine(gridLinePen, e.CellBounds.Right - 1,
                                                    e.CellBounds.Top, e.CellBounds.Right - 1,
                                                    e.CellBounds.Bottom);
                }
                // Draw the inset highlight box.
                //   e.Graphics.DrawRectangle(Pens.Blue, newRect);
                int scale = e.CellBounds.Height / 3;
                if (e.ColumnIndex > -1 && topRow.Cells[e.ColumnIndex].Text != null)
                {
                    scale = e.CellBounds.Height / 2;
                    e.Graphics.DrawLine(gridLinePen, e.CellBounds.Left, e.CellBounds.Bottom - e.CellBounds.Height / 2, e.CellBounds.Right, e.CellBounds.Bottom - e.CellBounds.Height / 2);
                }
                // Draw the text content of the cell, ignoring alignment.
                if (e.Value != null)
                {
                    e.Graphics.DrawString(e.Value.ToString(), e.CellStyle.Font,
                        Brushes.Crimson, e.CellBounds.X + 2,
                        e.CellBounds.Y + scale + 2, StringFormat.GenericDefault);
                }
                if (e.ColumnIndex > -1 && topRow.Cells[e.ColumnIndex].RelateIndex > -1 && topRow.Cells[e.ColumnIndex].Text != null)
                {
                    Rectangle recCell = new Rectangle(e.CellBounds.X - 1 - topRow.Cells[e.ColumnIndex].SpanRowWith,
    e.CellBounds.Y + 1, topRow.Cells[e.ColumnIndex].SpanRowWith,
    e.CellBounds.Height / 2);
                    StringFormat sf = new StringFormat();
                    sf.Alignment = StringAlignment.Center;
                    e.Graphics.DrawString(topRow.Cells[e.ColumnIndex].Text, e.CellStyle.Font, Brushes.Crimson, recCell, sf);
                }
                e.Handled = true;
            }
        }
    }
} 调用的方法 
[C#] 纯文本查看 复制代码 dataGridViewEx1.TopRow.Cells[2].Text = "入库";
            dataGridViewEx1.TopRow.Cells[2].ColSpan = 2;
            dataGridViewEx1.TopRow.Cells[4].Text = "出库";
            dataGridViewEx1.TopRow.Cells[4].ColSpan = 2; 
就这样就行了 
而且博客园有同者写的挺 不错了,基本上够用了。 
http://www.cnblogs.com/greatverve/archive/2012/03/05/multi-datagridview.html 
我还是去研究我的皮肤吧, 
你说的也不是不对,只是我是在想,如果我去开发一个这样的表格,说不定还没有第三方开发的好,因为人家毕竟研究了很久了。 
所以我才坚持我的皮肤,而不是单一组件。 
并不是不开发,而是不单一开发,要开发就是成套的控件 
 |