private void DVG_familyInfo_Paint(object sender, PaintEventArgs e)
{
for (int j = 0; j < DVG_familyInfo.ColumnCount; j++)
{
if (j == 5 || j == 9 || j == 11)
{
if (j == 5)
{
Rectangle r1 = this.DVG_familyInfo.GetCellDisplayRectangle(j, -1, true);
int w2 = this.DVG_familyInfo.GetCellDisplayRectangle(j + 1, -1, true).Width;
r1.Width = (r1.Width * 3) - 2;
r1.Height = (r1.Height / 2) - 1;
e.Graphics.FillRectangle(new SolidBrush(this.DVG_familyInfo.ColumnHeadersDefaultCellStyle.BackColor), r1);
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;
format.LineAlignment = StringAlignment.Near;
e.Graphics.DrawString("Date of Birth",
this.DVG_familyInfo.ColumnHeadersDefaultCellStyle.Font,
new SolidBrush(this.DVG_familyInfo.ColumnHeadersDefaultCellStyle.ForeColor), r1, format);
DVG_familyInfo.Columns[j].Width = 55;
}
if (j == 9)
{
Rectangle r1 = this.DVG_familyInfo.GetCellDisplayRectangle(j, -1, true);
int w2 = this.DVG_familyInfo.GetCellDisplayRectangle(j + 1, -1, true).Width;
r1.X += 1;
r1.Y += 1;
r1.Width = r1.Width + w2 - 2;
r1.Height = r1.Height / 2 - 2;
e.Graphics.FillRectangle(new SolidBrush(this.DVG_familyInfo.ColumnHeadersDefaultCellStyle.BackColor), r1);
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;
format.LineAlignment = StringAlignment.Near;
e.Graphics.DrawString("Education Qualification",
this.DVG_familyInfo.ColumnHeadersDefaultCellStyle.Font,
new SolidBrush(this.DVG_familyInfo.ColumnHeadersDefaultCellStyle.ForeColor), r1, format);
}
if (j == 11)
{
Rectangle r2 = this.DVG_familyInfo.GetCellDisplayRectangle(j, -1, true);
int w2 = this.DVG_familyInfo.GetCellDisplayRectangle(j + 1, -1, true).Width;
r2.X += 1;
r2.Y += 1;
r2.Width = r2.Width + w2 - 2;
r2.Height = r2.Height / 2 - 2;
e.Graphics.FillRectangle(new SolidBrush(this.DVG_familyInfo.ColumnHeadersDefaultCellStyle.BackColor), r2);
StringFormat format2 = new StringFormat();
format2.Alignment = StringAlignment.Center;
format2.LineAlignment = StringAlignment.Near;
e.Graphics.DrawString("Occupation",
this.DVG_familyInfo.ColumnHeadersDefaultCellStyle.Font,
new SolidBrush(this.DVG_familyInfo.ColumnHeadersDefaultCellStyle.ForeColor), r2, format2);
}
}
}
}
private void DVG_familyInfo_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e)
{
Rectangle rtHeader = this.DVG_familyInfo.DisplayRectangle;
rtHeader.Height = this.DVG_familyInfo.ColumnHeadersHeight / 2;
this.DVG_familyInfo.Invalidate(rtHeader);
}
private void DVG_familyInfo_Scroll(object sender, ScrollEventArgs e)
{
Rectangle rtHeader = this.DVG_familyInfo.DisplayRectangle;
rtHeader.Height = this.DVG_familyInfo.ColumnHeadersHeight / 2;
this.DVG_familyInfo.Invalidate(rtHeader);
}