DataGridView.ColumnWidthChanged Event

Definition

Occurs when the value of the Width property for a column changes.

C#
public event System.Windows.Forms.DataGridViewColumnEventHandler ColumnWidthChanged;
C#
public event System.Windows.Forms.DataGridViewColumnEventHandler? ColumnWidthChanged;

Event Type

Examples

The following code example illustrates the use of this event. This example is part of a larger example available in How to: Customize the Appearance of Rows in the Windows Forms DataGridView Control.

C#
// Forces the control to repaint itself when the user 
// manually changes the width of a column.
void dataGridView1_ColumnWidthChanged(object sender,
    DataGridViewColumnEventArgs e)
{
    this.dataGridView1.Invalidate();
}

Remarks

For more information about how to handle events, see Handling and Raising Events.

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

See also