资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

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://cdkjz.cn/article/jojgdi.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220