1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
void dataGridView2_Paint(object sender, PaintEventArgs e)
{
for (int j = 0; j < datagridviwe.column.count * 2; j++)
{
Rectangle r1 = this.dataGridView2.GetCellDisplayRectangle(j, -1, true);
int w2 = this.dataGridView2.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.dataGridView2.ColumnHeadersDefaultCellStyle.BackColor), r1);
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;
format.LineAlignment = StringAlignment.Center;
e.Graphics.DrawString(monthes1[j / 4],
this.dataGridView2.ColumnHeadersDefaultCellStyle.Font,
new SolidBrush(this.dataGridView2.ColumnHeadersDefaultCellStyle.ForeColor),
r1,
format);
j++;
}
} |
Partager