在Datagridview中扩展/折叠 [英] Expanding/collapsing in Datagridview

查看:176
本文介绍了在Datagridview中扩展/折叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How do I customize the Winforms DataGridView to support expanding and collapsing with a +/- sign?

谢谢。

推荐答案

DataGridView不支持您正在查看分层数据的+/-行标题按钮。

The DataGridView does not support the +/- row header button you're looking to display hierarchical data in.

您正在寻找的是DataGrid,它被DataGridView替换为.NET 2.0。 DataGrid仍然可以在更高版本的框架中使用(无论是向后兼容性还是我都确保使此功能可用):

What you are looking for is the DataGrid, which was replaced by the DataGridView starting .NET 2.0. The DataGrid is still available for use in later versions of the Framework however (both for backwards compatibility and I'm sure to make this feature available):

DataGrid控件概述(Windows窗体)

如何:使用Windows Forms DataGrid控件创建Master-Details列表

我以前在.NET 2.0项目中完成了这一点,正如我记得的,+/-按钮只能在DataSet中与两个相关的DataTable一起工作。让DataGrid以这种方式工作(DGV更容易使用)是一件困难的事情。

I've done this before in a .NET 2.0 project and as I recall the +/- buttons work only with two related DataTables in a DataSet. It was a bit of a struggle to get the DataGrid to work that way I wanted (DGV is much easier to work with).

这篇关于在Datagridview中扩展/折叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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