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 

事件類型

範例

下列程式碼範例說明如何使用這個事件。 此範例是How to: Customize the Appearance of Rows in the Windows Forms DataGridView Control中較大型範例的一部分。

// 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

備註

如需如何處理事件的詳細資訊,請參閱 處理和引發事件

適用於

另請參閱