当用户键入时,如何扩展datagridview列. [英] How can I expand the datagridview column as the user is typing.

查看:78
本文介绍了当用户键入时,如何扩展datagridview列.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在用户键入时扩展datagridview列.

How can I expand the datagridview column as the user is typing.

推荐答案


您可以尝试订阅CellBeginEdit事件,然后动态扩展它.这是一个丑陋的解决方案,但我看不到其他解决方法.
关于
Hi,
you might try subscribing to CellBeginEdit event, and expand it dynamically. It kind of an ugly solution, but I do not see other way of doing it.
Regards


在单元格上捕获适当的事件,测量当前文本,并通过分配其Width属性来调整列的大小.

对于第一部分(这比应做的要难),请参见 ^ ]或其他Google会找到您的东西.
Catch the appropriate event on the cell, measure the current text, resize the column by assigning to its Width property.

For the first part (which is harder than it should be), see here[^] or other things Google will find you.


这篇关于当用户键入时,如何扩展datagridview列.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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