DataGridView可调整大小的列,但是最后一列不能被调整得更大吗? [英] DataGridView resizeable columns, but last column can't be resized bigger?

查看:107
本文介绍了DataGridView可调整大小的列,但是最后一列不能被调整得更大吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


For c = 0 To grd.Columns.Count - 1
    grd.Columns(c).Resizable = DataGridViewTriState.True
Next c

这允许我DataGridView中的所有列都可调整大小,除了最后一列。为什么?
DO 得到了一些可调整大小的鼠标指针...但是您只能将列 SMALLER 设为,而不能将其设为 WIDER

That allows all the columns in my DataGridView to be resizable EXCEPT the last column. Why? I DO get the little resizable-mouse-pointer... but you can only make the column SMALLER, never WIDER.

(如果我尝试使用VB.net IDE将所有列设置为可调整大小,则存在相同问题)

(Same problem if I try to set all the columns to Resizable, using the VB.net IDE)

我在这里做错了什么?我不应该能够调整我想要的 ANY 列的大小,是大还是小?

What am I doing wrong here? Shouldn't I be able to resize ANY column I want, bigger or smaller?

推荐答案

您可能希望用户调整最后一列的左边缘的大小,而不能调整最后一列的右边缘的大小。

What you probably want is for the user to resize the left edge of last column, not to be able to resize the right edge of the last column.

一个选项是将最后一列的AutoSizeMode设置为填充,将其他列设置为其他模式,例如未设置。这样做可以使您在调整倒数第二列的右边缘大小时,最后一列的左边缘将自动填充该空间。

One option is to set the AutoSizeMode of the last column to 'Fill' and the other columns to some other mode, like 'Not Set'. Doing this would make it so that when you resize the right edge of the second-to-last column, then the left edge of the last column will automatically fill-in that space.

这篇关于DataGridView可调整大小的列,但是最后一列不能被调整得更大吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆