【问题标题】:Editable Column headers for WinForms DataGrid Control?WinForms DataGrid 控件的可编辑列标题?
【发布时间】:2010-08-06 10:54:45
【问题描述】:

我想显示一个 DataGrid 控件,其中列标题可由用户编辑。这可能吗?

【问题讨论】:

    标签: winforms datagridview columnheader


    【解决方案1】:

    即使默认的 DataGrid 不提供该功能,我使用的解决方法是捕获列标题的单击事件,然后使用 InputBox() 方法捕获新的列标题。

    InputBox 预先填充了默认列标题,然后验证输入字符串,我会更新标题。

    请注意,我提出了一种解决方法来获得该功能。

    InputBox() 位于 Microsoft.VisualBasic.dll 中,可以通过以下方式访问:

    Microsoft.VisualBasic.Interaction.InputBox()
    

    带有以下签名

    InputBox(prompt[, title] [, default] [, xpos] [, ypos] [, helpfile, context])
    

    希望对你有帮助!

    【讨论】:

      猜你喜欢
      • 2013-01-05
      • 1970-01-01
      • 1970-01-01
      • 2011-03-17
      • 1970-01-01
      • 2012-05-24
      • 1970-01-01
      • 2010-09-13
      • 1970-01-01
      相关资源
      最近更新 更多