To merge Cell in DataGridView You Have to Fire Paint event
after that give the RowHeight and RowWidth and number of cell to be merged
Code is Given below
dataGridView1.Paint += new PaintEventHandler(dataGridView1_Paint);
void dataGridView1_Paint(object sender, PaintEventArgs e)
{
Rectangle rct;
rct = e.ClipRectangle;
rct.X = dataGridView1.GetColumnDisplayRectangle(0, true).X;
rct.Y = dataGridView1.GetRowDisplayRectangle(6, true).Y;//here 6 is the ROW Number which you want to Merge
rct.Height = dataGridView1.Rows[1].Height;//.Cells[0].Size.Height;
rct.Width = dataGridView1.Rows[2].Cells[0].Size.Width * 4;// 4 is the no of cell to be merged
OR
rct.Width = dataGridView1.Width; // its Automatically Merge all the Cell of a ROW
e.Graphics.FillRectangle(Brushes.White, rct);
Pen p = new Pen(SystemColors.ControlDark);
e.Graphics.DrawRectangle(p, rct);
e.Graphics.DrawString("Total Salary " + SalarySum,new System.Drawing.Font("Arial",10,FontStyle.Bold ) ,Brushes.Blue, rct.X, Rect.Y);
}
Subscribe to:
Post Comments (Atom)
Mat Table Angular
Mat Table in Angular Mat table is used to display data . its a material designed styled data-table . For using Material Table MatTableMo...
-
CriteriaOperator criteria = new BinaryOperator("Age", 30, BinaryOperatorType.Greater); CriteriaOperator criteria = CriteriaOperato...
-
SortingCollection sc = new SortingCollection(); sc.Add (new SortProperty("field on which you want to sort",DevExpress.Xpo.DB.Sorti...
-
Minification and Uglyfication in Angular Deployement Minification : While building Angular Application white spaces , unused variable , u...
No comments:
Post a Comment