如果网格较小,则调整 DataGridView 的列以填充可用空间,并在网格大于可用空间的情况下使用滚动 [英] Adjust DataGridView's columns to fill available space if the grid is smaller and use scroll in case the grid bigger than the space available

查看:17
本文介绍了如果网格较小,则调整 DataGridView 的列以填充可用空间,并在网格大于可用空间的情况下使用滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想根据所需空间调整 DataGridView 的所有列以完整显示其所有数据.如果所需空间小于可用空间,我希望网格填充这个超出的空间,但如果可用空间不足以正确显示所有列,我希望 DataGridView 自动创建一个滚动.有没有简单的方法可以做到这一点?

I want to adjust all columns of a DataGridView according to the required space to show all its data completely. If the space required is smaller than the available space i want the grid to fill this exceeding space, but if the available is space is not enough to display properly all columns i want to DataGridView create automatically a scroll. Is there an easy way to do this?

推荐答案

单击 DataGridView 并选择Edit Columns...",然后转到Layout"并将AutoSizeMode"设置为Fill".

Click over the DataGridView and select "Edit Columns...", then go to "Layout" and set "AutoSizeMode" to "Fill".

希望这就是您要找的东西.

Hope this is what you're looking for.

干杯

这篇关于如果网格较小,则调整 DataGridView 的列以填充可用空间,并在网格大于可用空间的情况下使用滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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