以编程方式删除datagrid视图中的行标题 [英] removing row header in datagrid view programmatically

查看:117
本文介绍了以编程方式删除datagrid视图中的行标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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视图.....



非常感谢提前.....

解决方案

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




I have a datagrid view and i want to remove the row header for all rows...

I am trying to remove the rounded part as shown in belowfigure (Row header)

For that I have written the code below.... but it s not woking....

     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;

     }

would any pls give any sample code for removing row header in datagrid view .....

Many thanks In advance.....

解决方案

Look for a RowHeadersVisible property on the DataGridView in the designer.

这篇关于以编程方式删除datagrid视图中的行标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆