Is there any common event for datagridview which is fired, when rowHeaderWidth of datagridview is changed or column Width of datagridview is changed?
I have used datagridview.ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e) it is invoked when column width is chang开发者_开发技巧ed but it is not invoked when row header width of the datagridview is changed.
I have also used dataGridView1_RowHeadersWidthChanged(object sender, EventArgs e) it is invoked when row header width is changed but it is not invoked when column width of the datagridview is changed.
So I want a common event which is invoked in both case...
Here's the updated code using both:
- ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e)
- RowHeadersWidthChanged(object sender, EventArgs e)
private void dataGridView1_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e)
{
MessageBox.Show("Column Width Changed");
widthChanged(sender, e);
}
private void dataGridView1_RowHeadersWidthChanged(object sender, EventArgs e)
{
MessageBox.Show("Row Header Width Changed");
widthChanged(sender, null);
}
private void widthChanged(object sender, DataGridViewColumnEventArgs e)
{
MessageBox.Show("Any Width Changed");
}
Works when I resized either header's column width or item's column width.
精彩评论