在DataGridView中创建组行 [英] Create group rows in DataGridView

查看:85
本文介绍了在DataGridView中创建组行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想做的是获取任何列并在datagridview中按该列动态分组。



我使用了DataGridViewGrouper,它允许我有可折叠的分组行。



但是分组的行是没有列,它的值是一个字符串。



我要做的就是将这一点更加扁平化,并设置一个特殊的动态列,并将总数分组。



我看过商业网格实现,但没有一个看起来像我想做的。





DataGridViewGrouper  https://www.codeproject.com/tips/995958/datagridviewgrouper &
OutlookGrid  https://www.codeproject.com/kb/grid/outlookgrid.aspx   solutions
提供分组和整体优秀。


< p style ="padding-right:0px;字体大小:15像素;明确:两者;颜色:#242729; font-family:Arial,'Helvetica Neue',Helvetica,sans-serif">
有没有办法在覆盖的Paint或PaintCells方法中绘制细胞而不是graphics.DrawString。

解决方案


我担心它不能用DataGridView做到。


请尝试使用列自定义TreeView,请参阅:
https ://www.codeproject.com/Articles/23746/TreeView-with-Columns


最好的问候,


Bob


What I would like to do is take any column and dynamically group by that column in datagridview.

I have used a DataGridViewGrouper which allows me have collapsable grouped rows.

But the grouped row is does not have columns and its value is a string.

What I would lile to do is to flatten this a little more and to have a special dynamic column and grouped rows with totals.

I have looked at commercial grid implementations but none look like what I want to do.

Both DataGridViewGrouper https://www.codeproject.com/tips/995958/datagridviewgrouper and OutlookGrid https://www.codeproject.com/kb/grid/outlookgrid.aspx solutions offer grouping and great overall.

Is there a way to paint cells in overridden Paint or PaintCells methods of the grouped row instead of graphics.DrawString.

解决方案

Hi,

I'm afraid it can't do that with DataGridView.

Please try custom TreeView with columns, refer to: https://www.codeproject.com/Articles/23746/TreeView-with-Columns

Best Regards,

Bob


这篇关于在DataGridView中创建组行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆