public void Clear()
        {
            cursorXPos = 0;
            cursorYPos = 0;
            ConsoleCharCell defaultCell = new ConsoleCharCell('\0', backColor, foreColor);

            using (Graphics graphics = Graphics.FromImage(bitmapBuffer))
            {
                graphics.Clear(drawBackColor);
            }
            for (int currCellIndex = 0; currCellIndex < cells.Length; currCellIndex++)
            {
                cells[currCellIndex] = defaultCell;
            }
            changedCells.Clear();
            UpdateCaretPos();
            this.Refresh();
        }
        private void UpdateBufferSize()
        {
            ConsoleCharCell defaultCell = new ConsoleCharCell('\0', defaultBackColor, defaultForeColor);

            ConsoleCharCell[] newCells        = new ConsoleCharCell[columns * rows];
            Bitmap            newBitmapBuffer = new Bitmap(columns * 8, rows * 12);
            int copyingCells;

            if (cells != null)
            {
                copyingCells = Math.Min(cells.Length, newCells.Length);
                for (int currCellIndex = 0; currCellIndex < copyingCells; currCellIndex++)
                {
                    newCells[currCellIndex] = cells[currCellIndex];
                }
            }
            else
            {
                copyingCells = 0;
            }
            cells = newCells;
            for (int currCellIndex = copyingCells; currCellIndex < cells.Length; currCellIndex++)
            {
                cells[currCellIndex] = defaultCell;
            }
            using (Graphics graphics = Graphics.FromImage(newBitmapBuffer))
            {
                graphics.Clear(drawBackColor);
                if (bitmapBuffer != null)
                {
                    graphics.DrawImage(bitmapBuffer, 0, 0);
                }
            }
            bitmapBuffer = newBitmapBuffer;
            ScrollbarsCheck();
        }