private void MergeCellsInColumn(int col, int row1, int row2) { Graphics g = DG.CreateGraphics(); Pen p = new Pen(DG.GridColor); Rectangle r1 = DG.GetCellDisplayRectangle(col, row1, true); Rectangle r2 = DG.GetCellDisplayRectangle(col, row2, true); int recHeight = 0; string recValue = string.Empty; for (int i = row1; i <= row2; i++) { recHeight += DG.GetCellDisplayRectangle(col, i, true).Height; if (DG[col, i].Value != null) { recValue += DG[col, i].Value.ToString() + " "; } } Rectangle newCell = new Rectangle(r1.X, r1.Y, r1.Width, recHeight); g.FillRectangle(new SolidBrush(DG.DefaultCellStyle.BackColor), newCell); g.DrawRectangle(p, newCell); g.DrawString(recValue, DG.DefaultCellStyle.Font, new SolidBrush(DG.DefaultCellStyle.ForeColor), newCell.X + 3, newCell.Y + 3); }