【发布时间】:2010-08-06 10:54:45
【问题描述】:
我想显示一个 DataGrid 控件,其中列标题可由用户编辑。这可能吗?
【问题讨论】:
标签: winforms datagridview columnheader
我想显示一个 DataGrid 控件,其中列标题可由用户编辑。这可能吗?
【问题讨论】:
标签: winforms datagridview columnheader
即使默认的 DataGrid 不提供该功能,我使用的解决方法是捕获列标题的单击事件,然后使用 InputBox() 方法捕获新的列标题。
InputBox 预先填充了默认列标题,然后验证输入字符串,我会更新标题。
请注意,我提出了一种解决方法来获得该功能。
InputBox() 位于 Microsoft.VisualBasic.dll 中,可以通过以下方式访问:
Microsoft.VisualBasic.Interaction.InputBox()
带有以下签名
InputBox(prompt[, title] [, default] [, xpos] [, ypos] [, helpfile, context])
希望对你有帮助!
【讨论】: