Building a Drop-Down Filter List for a DataGridView Column Header Cell
参考:http://msdn.microsoft.com/zh-cn/library/aa480727(en-us).aspx
1、引用DataGridViewAutoFilter.dll文件
2、C#程序调用时,只需要添加:
BindingSource dataSource = new BindingSource(_DataView, null);
dataGridView1.DataSource = dataSource;
//在表头增加自动过滤功能
foreach (DataGridViewColumn col in dataGridView1.Columns)
{
col.HeaderCell = new DataGridViewAutoFilterColumnHeaderCell(col.HeaderCell);
}
时间: 2024-10-08 15:13:20