问题描述
我开始新的数据库项目,其中我有一些表,也许20列,以显示
在DBGrid,但我知道,不可能显示所有20列在Grid中,因为它将需要太多空间。
我需要这样的选项,用户可以调整要显示或隐藏的列。
什么是一个简单和适当的解决方案呢?
其他解决方案也会被接受。
I am starting new database project, where I have some tables and maybe 20 columns to show in DBGrid at all, but I know it is not possible to show all 20 columns in Grid as it will need too much space.I need such option that user can adjust which columns to show or hide.what would be a easy and proper solution for it?other solutions will also be accepted.
感谢大家的帮助。
推荐答案
有两种方法。
第一。您正在使用自动创建的dbgrid列。这意味着,您不必手动创建列,在这种情况下,您可以更改底层表中相应字段的Visible属性。
1st. You are using automatically created dbgrid columns. this mean, that you do not create columns manually and in this case you can change Visible property for the corresponging field in underlying table.
2st。 DBGrid中的列是由您手动创建的,您可以更改TDbGridColumn本身的Visible属性。
2st. Columns in your DBGrid were created by you manually, and you can change Visible property for the TDbGridColumn itself.
这篇关于正确的方式来隐藏/显示DBGrid上的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!