background image

                                                          e.CellBounds.Top, e.CellBounds.Right - 1,
                                                          e.CellBounds.Bottom);
                        } 

                        

// Draw the inset highlight box.

                        //   e.Graphics.DrawRectangle(Pens.Blue, newRect); 

                        

int

 scale = e.CellBounds.Height/3;

                        

if

 (e.ColumnIndex > -1 && topRow.Cells[e.ColumnIndex].Text != 

null

)

                        {
                            scale= e.CellBounds.Height / 2;
                            e.Graphics.DrawLine(gridLinePen, e.CellBounds.Left, e.CellBounds.Bottom - e.CellBounds.Height / 2, e.CellBounds.Right
, e.CellBounds.Bottom - e.CellBounds.Height / 2);
                        } 
                        

// Draw the text content of the cell, ignoring alignment. 

                      

                        

if

 (e.Value != 

null

)

                        {
                            e.Graphics.DrawString(e.Value.ToString(), e.CellStyle.Font,
                                Brushes.Crimson, e.CellBounds.X + 2,
                                e.CellBounds.Y + scale+ 2, StringFormat.GenericDefault);

                        } 

                        

if

 (e.ColumnIndex > -1 &&  topRow.Cells[e.ColumnIndex].RelateIndex > -1 && topRow.Cells[e.ColumnIndex].Text!=

null

)

                    
                        {
                            Rectangle recCell = 

new

 Rectangle(e.CellBounds.X - 1 - topRow.Cells[e.ColumnIndex].SpanRowWith,

           e.CellBounds.Y + 1, topRow.Cells[e.ColumnIndex].SpanRowWith,
           e.CellBounds.Height / 2);

                            StringFormat sf = 

new

 StringFormat();

                            sf.Alignment = StringAlignment.Center;