如何获取DataGridView中的CurrentCell位置
你好 如何获取 DataGridView 中的 CurrentCell 位置。我需要什么时候我的负载将加载上面在 datagridview 当前单元格上设置的每个组合框。并获得相同的尺寸。我怎样才能做到这一点?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用从零开始的索引。 com/en-us/library/system.windows.forms.datagridviewcell.columnindex.aspx" rel="nofollow">
CurrentCell
属性:或者,您可以使用
OwningColumn
属性:请注意,我仍然不完全确定是否这就是你所要求的。我的表单没有列,因此我假设您指的是
DataGridView
。您的答案仍然没有真正解释“位置”的确切含义,但这应该告诉您有关包含当前单元格的列所需了解的所有信息。You can get the zero-based index of the column that contains the currently selected cell by using the
ColumnIndex
property of theCurrentCell
property:Or, you can get the column object itself that contains the currently selected cell by using the
OwningColumn
property:Note that I'm still not entirely sure if this is what you're asking for. My forms don't have columns, so I'm assuming that you mean the
DataGridView
. And your answer still doesn't really explain what exactly you mean by "location," but this should tell you everything you need to know about the column that contains the current cell.