Hello,
I have a datagridview control on panel with other controls. This panel sits on a form. Panels AutoScroll property is set to True and the datagridview's ScrollBars property is set to None. I am calulating the height of the grid.
As soon as we set focus on the datagridview say by clicking on it the grid it places itself on top of the panel. It jumps up. As a result i have to scroll up to view the other controls.
Here is the code -
for (int i = 0; i < 100; i++)
{
this.dataGridView1.Rows.Add(i.ToString());
}
int ht = this.dataGridView1.ColumnHeadersHeight;
ht += ((this.dataGridView1.RowTemplate.Height - 1) * 100);
this.dataGridView1.Height = ht;
Why does focusing on the grid trigger scrolling?
Thanks,
Anica
I have a datagridview control on panel with other controls. This panel sits on a form. Panels AutoScroll property is set to True and the datagridview's ScrollBars property is set to None. I am calulating the height of the grid.
As soon as we set focus on the datagridview say by clicking on it the grid it places itself on top of the panel. It jumps up. As a result i have to scroll up to view the other controls.
Here is the code -
for (int i = 0; i < 100; i++)
{
this.dataGridView1.Rows.Add(i.ToString());
}
int ht = this.dataGridView1.ColumnHeadersHeight;
ht += ((this.dataGridView1.RowTemplate.Height - 1) * 100);
this.dataGridView1.Height = ht;
Why does focusing on the grid trigger scrolling?
Thanks,
Anica