在DataGridView中排列列 [英] Arrange Columns in a DataGridView
本文介绍了在DataGridView中排列列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个由存储过程填充的 datagridview
。通常,我将使用编辑列对话框重新排列列,但这个 datagridview
正用于显示来自不同来源的数据,所以我无法做到这一点。
I have a datagridview
that is populated by a stored proc. Typically I would reorder the columns using the 'Edit Columns' dialog but this datagridview
is being used to display data from different sources so I can't do that.
我已经弄清楚如何重命名标题并使某些列冻结,但是如何更改其上的显示顺序?
I have figured out how to rename the Headers and make certain columns Frozen but how do I change the display order on them?
推荐答案
使用 DisplayIndex 属性
myGridView.Columns["myFirstCol"].DisplayIndex = 0;
myGridView.Columns["mySecondCol"].DisplayIndex = 1;
这篇关于在DataGridView中排列列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文