HI all I solved that but please feel free to add any answer better than this.
this is my codes.
private void DrawingList_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
{
if (DrawingList.Rows[e.RowIndex].Cells[e.ColumnIndex].Selected == true)
{
e.Paint(e.CellBounds, DataGridViewPaintParts.All & ~DataGridViewPaintParts.Border);
using (Pen p = new Pen(Color.Blue, 1))
{
System.Drawing.Rectangle rect = e.CellBounds;
rect.Width -= 2;
rect.Height -= 2;
e.Graphics.DrawRectangle(p, rect);
}
e.Handled = true;
}
if (DrawingList.SelectedCells.Count>0)
{
if (e.RowIndex == DrawingList.SelectedCells[0].RowIndex)
{
e.Paint(e.CellBounds, DataGridViewPaintParts.All & ~DataGridViewPaintParts.Border);
using (Pen p = new Pen(Color.Blue, 1))
{
System.Drawing.Rectangle rect = e.CellBounds;
rect.Height -= 2;
e.Graphics.DrawRectangle(p, rect);
}
e.Handled = true;
}
}
}
}
and
private void DrawingList_SelectionChanged(object sender, EventArgs e)
{
if (DrawingList.SelectedCells.Count > 0)
{
DrawingList.Invalidate();
}
}
Happy coding!!