Мне нужно создать функцию, чтобы получить левую и правую координаты строки данных для Graphics.DrawLine()
.
(int x, int y) GetCoordinate(DataGridViewRow row, char leftOrRight)
{
if (leftOrRight == "L") {
return ( ) // the left coordinates or current row if visible,
// or the coordinates of the header line if it's not visible
}
else if (leftOrRight == "R") {
return ( ) // the right coordinates or current row if visible,
// or the coordinates of the header line if it's not visible
}
}
Использование:
var (x1, y1) = GetCoordinate(row1); // a row from data grid view 1
var (x2, y2) = GetCoordinate(row2); // a row from data grid view 2
graphics.DrawLine(pen, x1, y1, x2, y2);
Как получить координатыот объекта DataGridViewRow
?