vb.net 用户无法调整 DataGridView 列的大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17680415/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
User can't resize DataGridView columns
提问by Paul
I have a DataGridView with the datasource set to a binding source of data. My problem is I cannot get mostof the columns to resize. Several of the columns don't show a resize cursor, while two others do: one can be resized, one cannot.
我有一个 DataGridView,其数据源设置为绑定数据源。我的问题是我无法调整大部分列的大小。几列不显示调整大小光标,而另外两列显示:一列可以调整大小,一列不能。
Here is what I have tried:
这是我尝试过的:
DGV.AllowUsertoResizeColumns = TrueDGV.AutoSizeColumnMode = NoneDGV.RowHeadersWidthSizeMode = EnableResizingDGV.Dock = Fill- All Columns having
AutoSizeMode = NoneSetandResizable = True - The DGV is embedded in a panel of a SplitContainer, yet after bringing it to front, the others to back, or other random combinations, still unable to resize
- Using
dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.ColumnHeader)(and other variations) after data has been loaded into the DGV - While I'm able to resize one of the columns, the settings in the Columns collection are no different from the others
DGV.AllowUsertoResizeColumns = TrueDGV.AutoSizeColumnMode = NoneDGV.RowHeadersWidthSizeMode = EnableResizingDGV.Dock = Fill- 所有列具有
AutoSizeMode = NoneSet和Resizable = True - DGV嵌入到SplitContainer的面板中,但是在把它放在前面,其他到后面,或者其他随机组合后,仍然无法调整大小
dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.ColumnHeader)在数据加载到 DGV 后使用(和其他变体)- 虽然我可以调整其中一列的大小,但 Columns 集合中的设置与其他设置没有区别
Here's a screenshot of the properties of my DataGridView:
这是我的属性的屏幕截图DataGridView:
Any Ideas?
有任何想法吗?
采纳答案by Paul
Upon checking the individual column settings in the gridview, I found some cells still had
在检查 gridview 中的各个列设置后,我发现一些单元格仍然有
AutoSizeMode = AllCells
AutoSizeMode = AllCells
I changed this to:
我把这个改成:
AutoSizeMode = NotSet
AutoSizeMode = NotSet
and now I am able to resize all columns.
现在我可以调整所有列的大小。


