回复 1楼piqiu的帖子
DropDownList里面的项目是可以定制的,你可以选择自己定制这个HeaderDropDownList,并处理不同项目的Click事件,参考下面代码:- private void Form1_Load(object sender, EventArgs e)
- {
- DropDownSortItem dropDownSortItem1 = new DropDownSortItem();
- dropDownSortItem1.Click += dropDownSortItem1_Click;
- DropDownSortItem dropDownSortItem2 = new DropDownSortItem();
- DropDownSeparatorItem dropDownSeparatorItem1 = new DropDownSeparatorItem();
- DropDownShowAllFilterItem dropDownShowAllFilterItem1 = new DropDownShowAllFilterItem();
- DropDownBlanksFilterItem dropDownBlanksFilterItem1 = new DropDownBlanksFilterItem();
- DropDownNonBlanksFilterItem dropDownNonBlanksFilterItem1 = new DropDownNonBlanksFilterItem();
- DropDownAutoFilterItem dropDownAutoFilterItem1 = new DropDownAutoFilterItem();
- HeaderDropDownList headerDropDownList1 = new HeaderDropDownList("textBoxCell1", new DropDownItem[] { dropDownSortItem1,
- dropDownSortItem2,dropDownSeparatorItem1,dropDownShowAllFilterItem1,dropDownBlanksFilterItem1,dropDownNonBlanksFilterItem1,dropDownAutoFilterItem1});
- (this.gcMultiRow1.ColumnHeaders[0].Cells[0] as ColumnHeaderCell).DropDownList = headerDropDownList1;
- }
- void dropDownSortItem1_Click(object sender, EventArgs e)
- {
- //Do some thing.
- }
复制代码 |