DataGridView标头可以自动调整其大小吗? [英] Can the DataGridView header automatically resize itself?

查看:55
本文介绍了DataGridView标头可以自动调整其大小吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

数据网格中是否存在一项功能,该功能会根据列中最长的字符自动调整自身大小(标题)?

Is there a feature in datagrids that will automatically resize itself (the headers) depending on the longest characters in its column?

例如,如果我有一个很长的这句话,我的datagrid标头会自动调整其大小,以使消息不会被剪切。

For example, if I have a long sentence, my datagrid header will automatically resize itself so that the message won't be cut.

推荐答案

使用DataGridView.AutoSizeColumnsMode属性属性。

例如,

dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;

这篇关于DataGridView标头可以自动调整其大小吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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