DataGridView.ColumnWidthChanged 事件

定义

当列的 Width 属性值更改时发生。

public:
 event System::Windows::Forms::DataGridViewColumnEventHandler ^ ColumnWidthChanged;
public event System.Windows.Forms.DataGridViewColumnEventHandler ColumnWidthChanged;
public event System.Windows.Forms.DataGridViewColumnEventHandler? ColumnWidthChanged;
member this.ColumnWidthChanged : System.Windows.Forms.DataGridViewColumnEventHandler 
Public Custom Event ColumnWidthChanged As DataGridViewColumnEventHandler 

事件类型

示例

下面的代码示例演示了此事件的用法。 此示例是如何:自定义 DataGridView 控件中行的外观中提供的更大示例的 Windows 窗体一部分。

// 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();
}
' Forces the control to repaint itself when the user 
' manually changes the width of a column.
Sub dataGridView1_ColumnWidthChanged(ByVal sender As Object, _
    ByVal e As DataGridViewColumnEventArgs) _
    Handles dataGridView1.ColumnWidthChanged

    Me.dataGridView1.Invalidate()

End Sub

注解

有关如何处理事件的详细信息,请参阅 处理和引发事件

适用于

另请参阅