-1
- 我創建Form1中含有1個用戶控件與名稱的MyUserControl
- 和的MyUserControl包含1個ListView中有4列有姓名欄(默認,ID,姓名,職務)
我想火災事件ListView的ColumWidthChanging不允許改變寬度列表視圖如何在用戶控件winform C#中創建事件columnwidthchanging?
- 所以我該怎麼做?
拜託,有人幫我!!!
我的代碼中的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;
}
}
我的代碼在Form1中:
My_UC.columnWidthChangingListViewCategoryClick += new EventHandler(columnWidthChangingListViewCategoryClick_MyUC);
private void columnWidthChangingListViewCategoryClick_MyUC(object sender, EventArgs e) { }
我的代碼不火