DatagridView:删除未使用的空间? [英] DatagridView: Remove unused space?

查看:174
本文介绍了DatagridView:删除未使用的空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以删除C#中DataGridView控件的未使用空间(灰色空间)。我必须使DataGridView仅显示白表。

I was wondering whether it is possible to remove the unused space ( the gray space ) of the DataGridView control in C#. I have to make the DataGridView display the white table only.

alt text http://www.timvw.be/wp-content/images/datagridview-to-excel-1.gif

任何建议?

推荐答案

RowsHeaderVisible 属性设置为false,来自设计师,类别 Appearence ,或从代码:

Set the RowsHeaderVisible property to false, you can either do that from the designer, in category Appearence, or from the code :

dataGridView1.RowsHeaderVisible = false;

为了删除左侧的指示符行,对于其余的灰色空间,您可以尝试将上述 AutoSizeColumnsMode 设置为填充,但是您仍然会在缺少行的情况下将较低部分变灰。

In order to remove the indicator row on the left side, as for the rest of the grey space, you can try set the aforementionned AutoSizeColumnsMode to Fill, but you will still have the lower part grayed out from lack of rows.

您可以调整您的网格的大小,以适应您的单元格,而不是调整您的单元格的大小。这是否是可接受的方法将取决于您的意图。

Instead of sizing your cells to fill your grid, you could resize your grid in order to fit around your cells. Whether or not this is an acceptable approach will depend on your intent.

我的意思是,如果它只是打扰你的颜色可能,将背景颜色设置为白色会做的伎俩。

I mean, it's possible that if its just the color that is bothering you, setting the backcolor to white would do the trick.

这篇关于DatagridView:删除未使用的空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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