- 9
- 0
- 约1.28万字
- 约 13页
- 2017-12-12 发布于河南
- 举报
DataGridView合并行
DataGridView
主要用到datagridview的单元格重画事件。
protected override void OnCellPainting(System.Windows.Forms.DataGridViewCellPaintingEventArgs e)
还有GDI画图,
复合表头如下图:
合并行的话同样是使用了其单元格重画事件:private void DrawCell(DataGridViewCellPaintingEventArgs e)
对上下单元格相同内容的合并。
同样是通过GDI实现。
具体的请见下面的源码
效果图如下:
复合表头源码如下:
public partial class HeaderUnitView : DataGridView
{
private TreeView[] _columnTreeView;
private ArrayList _columnList = new ArrayList();
private int _cellHeight = 17;
public int CellHeight
{
get { return _cellHeight; }
原创力文档

文档评论(0)