how to create event columnwidthchanging in usercontrol winform C#? -


  • i create form1 contain 1 usercontrol name myusercontrol
    • and myusercontrol contains 1 listview have 4 columns name column(default,id,name,position)

i want fire event columwidthchanging of listview no allow change width column listview

  • so how do ?

please, me!!!

my code in myusercontrol:

public event eventhandler columnwidthchanginglistviewcategoryclick;     private void listview_category_columnwidthchanging(object sender, columnwidthchangingeventargs e)     {         if (columnwidthchanginglistviewcategoryclick != null)         {             columnwidthchanginglistviewcategoryclick(sender, e);         }         if (e.columnindex == 1 || e.columnindex == 3)         {             e.newwidth = 0;             e.cancel = true;         }     } 

my code in form1:

    my_uc.columnwidthchanginglistviewcategoryclick += new eventhandler(columnwidthchanginglistviewcategoryclick_myuc); private void columnwidthchanginglistviewcategoryclick_myuc(object sender, eventargs e) { } 

my code not fire

you can try better listview express allows setting minimum, maximum width each column , various styles (non-resizable, nonclickable, sortable etc.).


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -