I'm using a msflexgrid to input and edit a square data matrix. It can have 4 different selectable dimensions as in the attached figure: N x N where N is any number from (3, 5, 7, 9). There are no fixed rows or columns.

Name:  gridz.jpg
Views: 353
Size:  37.7 KB

I'm confused about how to correctly calculate the overall grid width and height from the individual row height and column width.

So far I've tried:

.Width = n * (.ColWidth(0) + (.GridLineWidth + 1) * Tx) + 2 * .BorderStyle * Tx
.Height = n * (.RowHeight(0) + (.GridLineWidth + 1) * Ty) + 2 * .BorderStyle * Ty

where n is the number of rows (or columns) and Tx and Ty are variables representing TwipsPerPixelX and TwipsPerPixelY.

As it is obvious, this is wrong, but I just don't know what I'm missing.