| my prog |
| 1 | //GetColumnActualWidth public double GetColumnActualWidth(int column) { int minColumnSpan = int.MinValue; double width = 0; foreach (var cell in Cells.Where(x => x.Column == column)) { if (cell.ColumnSpan == 1) return cell.ActualWidth; if (cell.ColumnSpan < minColumnSpan) { minColumnSpan = cell.ColumnSpan; width = cell.ActualWidth; } } return width; } |
| 2 | //GetColumnsActualWidth public double GetColumnsActualWidth(int startColumn, int columnSpan) { double width = 0; for (int col = startColumn; col < startColumn + columnSpan; col++) width += GetColumnActualWidth(col); return width; } |
| 3 | //GetRowActualHeight public double GetRowActualHeight(int row) { int minRowSpan = int.MinValue; double height = 0; foreach (var cell in Cells.Where(x => x.Row == row)) { if (cell.RowSpan == 1) return cell.ActualHeight; if (cell.RowSpan < minRowSpan) { minRowSpan = cell.RowSpan; height = cell.ActualHeight; } } return height; } |
| 4 | //GetRowsActualHeight public double GetRowsActualHeight(int startRow, int rowSpan) { double height = 0; for (int row = startRow; row < startRow + rowSpan; row++) height += GetRowActualHeight(row); return height; } |
| 5 | //GetCellBounds public Rect GetCellBounds(StatsTableCellViewModel cell) { double x = 0; double y = 0; |
| 6 | for (int col = 0; col < cell.Column; col++) x += GetColumnActualWidth(col); for (int row = 0; row < cell.Row; row++) y += GetRowActualHeight(row); return new Rect(x, y, cell.ActualWidth, cell.ActualHeight); |
Комментарии