private Rectangle GetCellRectangle(int columnIndex, int rowIndex)
{
Rectangle selRect = new Rectangle(0, 0, 0, 0);
selRect.X = RowHeadersWidth + 1;
for (int i = FirstDisplayedScrollingColumnIndex; i < columnIndex; i++)
{
selRect.X += Columns[i].Width;
}
selRect.X -= FirstDisplayedScrollingColumnHiddenWidth;
selRect.Y = ColumnHeadersHeight + 1;
for (int i = FirstDisplayedScrollingRowIndex; i < rowIndex; i++)
{
selRect.Y += Rows[i].Height;
}
selRect.Width = Rows[rowIndex].Cells[columnIndex].Size.Width;
selRect.Height = Rows[rowIndex].Cells[columnIndex].Size.Height;
return selRect;
}
該方法返回CellDisplayRectangle在aprox的8-10蜱,insted的1300
迄今最好的主意! ty – Mastenka
嗯,我不能把這個標記爲答案,因爲這樣可以找到當前單元格的寬度和高度,但是你不能找到單元格的X和Y這種方式。 – Mastenka
在窗體或dgv中的位置? –