【问题标题】:Expanding/collapsing in Datagridview在 Datagridview 中展开/折叠
【发布时间】:2011-03-11 06:22:26
【问题描述】:

如何自定义 Winforms DataGridView 以支持使用 +/- 符号展开和折叠?

谢谢。

【问题讨论】:

    标签: winforms datagridview


    【解决方案1】:

    DataGridView 不支持您要在其中显示分层数据的 +/- 行标题按钮。

    您正在寻找的是 DataGrid,从 .NET 2.0 开始,它已被 DataGridView 取代。然而,DataGrid 仍可用于框架的更高版本(既是为了向后兼容,而且我肯定会提供此功能):

    DataGrid Control Overview (Windows Forms)
    How to: Create Master-Details Lists with the Windows Forms DataGrid Control Using the Designer

    我以前在 .NET 2.0 项目中做过这个,我记得 +/- 按钮只适用于数据集中的两个相关数据表。让 DataGrid 以我想要的方式工作有点困难(DGV 更容易使用)。

    【讨论】:

    • 谢谢!我正在维护一些旧代码并试图关闭不断出现的主从小部件!
    猜你喜欢
    • 2018-12-13
    • 1970-01-01
    • 1970-01-01
    • 2013-06-06
    • 2012-05-30
    • 2017-02-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多