I have a problem with merge the datagridview headers in winForm.
I using this code :
void dataGridView1_Paint(object sender, PaintEventArgs e)
{
I believe the easiest way would be to invalidate merged header's cells every time the datagridview is scrolled. You would need to add a handler to the Scroll event:
dataGridView1.Scroll += new System.Windows.Forms.ScrollEventHandler(this.dataGridView1_Scroll);
Below is scroll event handler implementation:
private void dataGridView1_Scroll(object sender, ScrollEventArgs e)
{
Rectangle rect = Rectangle.Union(
dataGridView1.GetCellDisplayRectangle(2, -1, true),
dataGridView1.GetCellDisplayRectangle(3, -1, true));
dataGridView1.Invalidate(rect);
}
hope this helps, regards