189 8069 5689

c#消除datagridview单元格选中边框

通过CellPaint事件解决单元格选中边框问题。

成都创新互联公司凭借在网站建设、网站推广领域领先的技术能力和多年的行业经验,为客户提供超值的营销型网站建设服务,我们始终认为:好的营销型网站就是好的业务员。我们已成功为企业单位、个人等客户提供了成都网站建设、成都网站制作服务,以良好的商业信誉,完善的服务及深厚的技术力量处于同行领先地位。

public void PaintBackground (

Rectangle clipBounds,

bool cellsPaintSelectionBackground

)

参数:

clipBounds

一个指定要绘制的 DataGridView 区域的 Rectangle。

cellsPaintSelectionBackground

true 用于使用 DataGridViewCell.InheritedStyle 的 SelectionBackColor 属性的颜色绘制指定边界的背景;false 用于使用 DataGridViewCell.InheritedStyle 的 BackColor 属性的颜色绘制指定边界的背景。

public void PaintContent (

Rectangle clipBounds

)

参数

clipBounds

一个指定要绘制的 DataGridView 区域的 Rectangle。

添加DataGridView的CellPaint事件,代码如下:

private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)

{

e.Handled = true;

e.PaintBackground(e.CellBounds, true);

e.PaintContent(e.CellBounds);

}


标题名称:c#消除datagridview单元格选中边框
文章出自:http://cdxtjz.cn/article/jojgdi.html

其他资讯