my datagridview 使用CellPainting事件。 我想在cell2上做一个矩形。
if (e.RowIndex >= suIndex1)
{
if (e.ColumnIndex == 7 || e.ColumnIndex == 8)
{
Point cursorPosition = this.dataOder.PointToClient(Cursor.Position);
if (e.CellBounds.Contains(cursorPosition))
{
Pen pen = new Pen(Color.Blue, 2f);
Rectangle a = new Rectangle(col4.X, col4.Y, widthSum, e.CellBounds.Height - 1);
e.Graphics.DrawRectangle(pen, a);
e.Handled = true;
}
}
}