Hi,
I'm trying to merge 5 cell in CellPainting event of datagridview with following code..
e.PaintBackground(e.ClipBounds, false);
int index = 1;//Unchecked image
int FirstRow = e.RowIndex;
Rectangle r_image = this.dg_admindata.GetCellDisplayRectangle(dg_admindata.ColumnCount - 1, e.RowIndex, true);
int w_2nd = this.dg_admindata.GetCellDisplayRectangle(dg_admindata.ColumnCount - 1, e.RowIndex + 1, true).Height;
int w_3rd = this.dg_admindata.GetCellDisplayRectangle(dg_admindata.ColumnCount - 1, e.RowIndex + 2, true).Height;
int w_4th = this.dg_admindata.GetCellDisplayRectangle(dg_admindata.ColumnCount - 1, e.RowIndex + 3, true).Height;
int w_5th = this.dg_admindata.GetCellDisplayRectangle(dg_admindata.ColumnCount - 1, e.RowIndex + 4, true).Height;
r_image.Width = r_image.Width - 1;
r_image.Height = r_image.Height + w_2nd + w_3rd + w_4th + w_5th - 1;
Color clrBackColor = Color.White;
e.Graphics.FillRectangle(new SolidBrush(clrBackColor), r_image);
e.Graphics.DrawImageUnscaled(imageList2.Images[index], e.CellBounds.X + 25, e.CellBounds.Y + 2);
e.Handled = true;
but this fill rectangle on two cells only.
How to fill for 5 cells ?
if any idea please share.
Thanks..