【问题标题】:removing row header in datagrid view programmatically以编程方式删除数据网格视图中的行标题
【发布时间】:2011-11-11 13:45:39
【问题描述】:

我有一个 Datagrid 视图,我想删除所有行的行标题...

我正在尝试删除圆角部分,如下图所示(行标题)

为此,我编写了下面的代码....但它不起作用...

     private void dgvProducts_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
     {
         e.PaintCells(e.ClipBounds, DataGridViewPaintParts.All);

         e.PaintHeader(DataGridViewPaintParts.All
             | DataGridViewPaintParts.Border
             | DataGridViewPaintParts.None
             | DataGridViewPaintParts.SelectionBackground
             | DataGridViewPaintParts.ContentBackground);

         e.Handled = true;

     }

请提供任何示例代码以删除 Datagrid 视图中的行标题.....

非常感谢。提前.....

【问题讨论】:

    标签: c# .net winforms datagridview


    【解决方案1】:

    在设计器中的 DataGridView 上查找 RowHeadersVisible 属性。

    【讨论】:

      【解决方案2】:

      从这里开始:

      DataGridView Class

      RowHeadersVisible 获取或设置一个值,指示是否 显示包含行标题的列。

      当你可以简单地将这个属性设置为 false 时,你为什么对你使用 RowPrePaint 如此刻薄?

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多