public int RowYDifference(int row1, int row2)
{
if (row1 == row2)
return 0;
if (this.TableModel == null || this.TableModel.Rows == null)
return 0;
int r1 = Math.Min(row1, row2);
int r2 = Math.Max(row1, row2);
if (r2 > this.TableModel.Rows.Count)
r2 = this.TableModel.Rows.Count;
int ydiff = 0;
RowCollection rows = this.TableModel.Rows;
for (int i = r1; i < r2; i++)
{
// Don't count this row if it is currently a hidden subrow
Row row = rows[i];
if (row != null)
{
if (row.Parent == null || row.Parent.ExpandSubRows)
ydiff += row.Height;
}
}
if (r1 == row1)
{
// Row2 > Row1 so return a +ve
return ydiff;
}
else
{
// Row2 < Row1 so return a -ve
return -ydiff;
}
}