如何创建带有复合列的 dbgrid?
我如何创建带有复合列的 dbgrid,
例如:dbgrid header |名称 | |第一|最后|
how can i create dbgrid with composite columns,
example :dbgrid header
| name |
| first | last |
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
合成应该/必须在数据集(表)上完成。
如果您使用 SQL Selects 来获取数据,则应在 select 语句中进行“组合”(语法取决于数据引擎/sql 服务器)。
您还可以在数据集上创建一个计算字段(查看帮助和使用 delphi 安装的示例)。
The composition should/has to be done on the dataset (table).
If you use a SQL Selects for getting your data, you shoud make the "composition" in the select statement (syntax depends of the data engine/sql server).
You can also make a calculated field on the datasset (look in help and in the examples installed with delphi.
您可以通过编码获得此类功能:
或通过付费:
You can get such functionality by coding:
Or by paying:
标准 Delphi DBGrid 不支持此类功能,但聚合字段类型除外,该类型仅在 ClientDataset 中受支持。
您可以使用提供此类功能的第 3 方网格组件。我个人喜欢 EhLib 网格,它提供了此功能以及许多其他功能。以下是带有嵌套列标题的 EhLib 的屏幕截图:
(来源:ehlib.com)
您可以查看其他截图在这个链接中:
http://www.ehlib.com/dbgrideh1.htm
Standard Delphi DBGrid does not support such feature except for Aggregate field type which is supported only in ClientDataset.
You can use 3rd-party grid components that provide such functionality. I personally like EhLib grid which provides this feature, and lots of other ones. Here is a screenshot of EhLib with nested column headers:
(source: ehlib.com)
You can see other screenshots in this link:
http://www.ehlib.com/dbgrideh1.htm