简体   繁体   中英

c# winforms - catch user's ColumnWidthChanged event?

I am trying to catch user changing the width of columns in DatagridView control. The ColumnWidthChanged event is getting fired when the form is build ( as explained here ) but this is not what I need, I need only when the user do it.

Looks simple but I can't find the right event - and I'v tried everything that looks related.

Any ideas?

Thanks

The solution I found:

    private void Form_Shown(object sender, EventArgs e)
    {
        dataGridView.ColumnWidthChanged += dataGridView_ColumnWidthChanged;
    }

    private void dataGridView_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e)
    {
        // it's the user who clicked!!
    }
private void FastObjectListView1_ColumnWidthChanged(object sender, ColumnWidthChangedEventArgs e)
{
    FastObjectListView foListView = sender as FastObjectListView;
    if (foListView.Focused == true)
    {
        //To do
    }
}

I used focus property to make sure it's changed by the user. I looked up into all the properties but didn't find anything else better.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM