且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2023-12-06 14:13:52


您可以尝试订阅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.