c# - 以编程方式删除数据 GridView 中的行标题

标签 c# .net winforms datagridview

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

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

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

     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 View 中的行标题......

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

最佳答案

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

RowHeadersVisible property set to false

关于c# - 以编程方式删除数据 GridView 中的行标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7324457/

相关文章:

c# - 查找序列中缺失和重叠的数字

c# - 在 Deedle 中选择特定行

.net - c# com 对象配置最佳实践

c# - 如何使用 zlib.NET 扩充文件?

.net - 构建 'flat'而不是 'tree' LINQ表达式

c# - 在ListView中强制显示滚动条?

c# - 找不到 System.Windows.Point

c# - 如何在 Visual Studio 中将编程文本注入(inject)到我的编码 UI 测试中(而不是录制的文本)?

c# - 为什么 C# 中没有 String.IsNumeric 函数

c# - 在 winform 上显示 HTML