}//recomputeSizes

        private void panel1_Paint(object sender, PaintEventArgs e)
        {
            if (mMatrices == null)
            {
                return;
            }

            Graphics g = e.Graphics;

            recomputeSizes(g);

            int ypos = 3;

            for (int matrixNum = 0; matrixNum < mMatrices.Length; matrixNum++)
            {
                MatrixDef md = mMatrices[matrixNum];
                ypos += DrawMatrix(matrixNum, ypos, md, g);
            } //for matrixNum
        }     //panel1_Paint
        private int DrawMatrix(int matrixNum, int ypos, MatrixDef md, Graphics g)
        {
            Font       font          = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            SolidBrush greenBrush    = new SolidBrush(Color.Green);
            int        outlineHeight = (md.rows * mCharSize.Height) + (2 * mStepSize);

            g.DrawString(matrixNum.ToString(), font, greenBrush, VX(0), VY(ypos + (outlineHeight / 2) - (mCharSize.Height / 2)));

            Pen pen = new Pen(Brushes.Blue, 4);

            g.DrawLine(pen, new Point(VX(mMatrixIndex + mIndentSize), VY(ypos)), new Point(VX(mMatrixIndex + 3), VY(ypos)));
            g.DrawLine(pen, new Point(VX(mMatrixIndex + 3), VY(ypos)), new Point(VX(mMatrixIndex + 3), VY(ypos + outlineHeight)));
            g.DrawLine(pen, new Point(VX(mMatrixIndex + 3), VY(ypos + outlineHeight)), new Point(VX(mMatrixIndex + mIndentSize), VY(ypos + outlineHeight)));

            SolidBrush drawBrush = new SolidBrush(Color.Black);


            int[] columnWidths     = new int[md.cols];
            int   totalWidthPixels = 0;

            for (int col = 0; col < md.cols; col++)
            {
                int maxWidth = -1;
                for (int row = 0; row < md.rows; row++)
                {
                    double value = md.elements[(row * md.cols) + col];
                    //string str = string.Format("{0,0:F2}", value);
                    string str      = string.Format("{0:0.00}", value);
                    int    strWidth = (int)((g.MeasureString(str, font).Width) + 1);
                    if (strWidth > maxWidth)
                    {
                        maxWidth = strWidth;
                    }
                }
                columnWidths[col] = maxWidth;
                totalWidthPixels += maxWidth;
            }
            totalWidthPixels += ((md.cols - 1) * mCharSize.Width);

            for (int row = 0; row < md.rows; row++)
            {
                int ly = ypos + (row * mCharSize.Height) + (mCharSize.Height / 2);
                int wx = mCharSize.Width + mMatrixIndex;
                for (int col = 0; col < md.cols; col++)
                {
                    double value = md.elements[(row * md.cols) + col];
                    string str   = string.Format("{0:0.00}", value);

                    Rectangle rect = new Rectangle(VX(wx), VY(ly), columnWidths[col], mCharSize.Height);

                    StringFormat sf = new StringFormat();
                    sf.Alignment = StringAlignment.Far;
                    g.DrawString(str, font, drawBrush, rect, sf);
                    //g.DrawString(str, font, drawBrush, VX(wx), VY(ly));

                    wx += (columnWidths[col]) + mCharSize.Width;
                }
            }

            //int totalWidthPixels = ((md.cols * 5) * mCharSize.Width) + (2 * mIndentSize);
            totalWidthPixels += (2 * mIndentSize);
            g.DrawLine(pen, new Point(VX(mMatrixIndex + totalWidthPixels - mIndentSize), VY(ypos)), new Point(VX(mMatrixIndex + totalWidthPixels), VY(ypos)));
            g.DrawLine(pen, new Point(VX(mMatrixIndex + totalWidthPixels), VY(ypos)), new Point(VX(mMatrixIndex + totalWidthPixels), VY(ypos + outlineHeight)));
            g.DrawLine(pen, new Point(VX(mMatrixIndex + totalWidthPixels), VY(ypos + outlineHeight)), new Point(VX(mMatrixIndex + totalWidthPixels - mIndentSize), VY(ypos + outlineHeight)));

            return(outlineHeight + (2 * mStepSize));
        }