Delphi 相当于 C# 的 DataGridView
Delphi 中是否有真正相当于 C# 的 DataGridView 的东西?
我已经尝试过
TStringGrid
- 但是,当所有项目都可见时,滚动条要么不可见,要么无论溢出的项目有多么少,它都是可能的最小滚动条,并且仅在释放滚动条时更新,而不是在拖动滚动条时更新
- 此外,如果您有一个固定行,那么除此之外还必须至少有一个(空)行,这既不方便又不美观
TDBGrid
- 但我似乎无法弄清楚如何以编程方式添加项目(而且我不认为它应该这样做)。如果我能做到这一点,
TDBGrid
就适合我使用。
- 但我似乎无法弄清楚如何以编程方式添加项目(而且我不认为它应该这样做)。如果我能做到这一点,
那么,Delphi 中相当于 C# 的 DataGridView
且不存在上面列出的问题的是什么?
Is there any real equivalent of C#'s DataGridView in Delphi?
I have tried
TStringGrid
- But the scrollbar is either invisible when all the items are visible, or it is the smallest scrollbar possible no matter how little the items are overflowed and only updates when the scrollbar is released, not when it is being dragged
- Also, if you have one fixed row, you have to have at least one (empty) row besides that, which is inconvenient and unsightly
TDBGrid
- But I can't seem to figure out how to add items programmatically (and I don't think it's meant to do that anyway). If I could do that,
TDBGrid
would be fine for me to use.
- But I can't seem to figure out how to add items programmatically (and I don't think it's meant to do that anyway). If I could do that,
So what is the Delphi equivalent of C#'s DataGridView
that doesn't have the problems listed above?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
DataGridView
是一个非常灵活的控件,可以在绑定和非绑定模式下工作,在Delphi端你必须在2种控件之间进行选择,例如如果控件的内容可以直接编辑(非绑定) )你可以选择像 TStringGrid 这样的组件,或者在绑定模式下,在 delphi 中称为数据感知,你必须选择像 dbgrid,在最后一种情况下,您编辑与控件关联的数据集,并且控件反映数据集的内容。使用最后一个场景。关于数据集组件,您有多个选项可供选择,也许最灵活的是TClientDataSet< /代码>
。如果您想了解有关此主题的更多信息,请查看这些链接
了解数据集索引
注意:在Delphi的最新版本中(XE2) 引入了一个名为 LiveBindings 的新概念,它在如何操作方面引入了重大变化将对象或组件绑定到集合或另一个组件。
The
DataGridView
is a very flexible control which can work in bound and unbound modes, in the Delphi side you must choose bewteen 2 kinds of controls, for example if the content of the control can be edited directly (unbound) you can choose a component like a TStringGrid or in bound mode which in delphi is called data-aware you must choose something like a dbgrid, in this last case you edit the dataset asociated to the control and the control reflect the content of the dataset. Using this last scenario. you have several options about the dataset component to choose maybe the most flexible is theTClientDataSet
. if you want learn more about this topic check these linksUnderstanding datasets Index
Note : in the last version of Delphi (XE2) a new concept was introduced called LiveBindings, which introduces big changes in how you can bind a object or component to a collection or another component.
我建议您检查 DevExpress.com QuantumGrid - 它可以在 Bound 和 Unvound 模式下工作
I would recommend you to check DevExpress.com QuantumGrid - it works both in Bound and Unvound mode