改变datagridview行头图标

private void dataGridView2_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
            
  RowIcon = Waf.Properties.Resources.a1;
  strToolTip = "****";
  e.Graphics.DrawImage(RowIcon, e.RowBounds.Left + dataGridView2.RowHeadersWidth - 20, e.RowBounds.Top + 1, 16, 16);//绘制图标
  dataGridView2.Rows[e.RowIndex].HeaderCell.ToolTipText = strToolTip;//设置提示信息
           
}

你可能感兴趣的:(改变datagridview行头图标)