C#Win App中的DataGridView中的自动筛选-2 [英] AutoFilter in DataGridView in C# Win App - 2
本文介绍了C#Win App中的DataGridView中的自动筛选-2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我有DataGridView,并想为其添加自动筛选功能.
我已经从 http://www.microsoft.com/下载了
Hello There,
I have DataGridView and want to add AutoFilter capability to it.
I have downloaded
"DataGridViewAutoFilter.dll" assembly
zh-cn/download/details.aspx?id = 23459 [^] [
from http://www.microsoft.com/en-us/download/details.aspx?id=23459[^][^]
Problem : I want to change Column Type To :
DataGridViewAutoFilterTextBoxColumn
代替
DataGridViewTextBoxColumn
怎么做???
请帮忙!!!
在此先感谢!
How to do this???
Please Help!!!
Thanks In Advance!!!
推荐答案
DataGridViewAutoFilterTextBoxColumn
可以在DataGridView
中使用,如下所示:
TheDataGridViewAutoFilterTextBoxColumn
can be used in theDataGridView
as shown below:
- 将
DataGridViewAutoFilter.dll
文件复制到相关项目的Bin
文件夹中 - 打开
Visual Studio
,右键单击Solution Explorer
中相关的Project
,然后选择Add Reference
从打开的上下文菜单中选择菜单选项 - 在
Add Reference Dialog
中选择Browse
选项卡页,然后通过导航到DataGridViewAutoFilter.dll
文件并复制到其中的文件夹来选择该文件 - 现在,在设计视图中打开
Form
,在其上放置DataGridView
- 右键单击
DataGridView
,然后从打开的上下文菜单中选择Edit columns
菜单选项 - 在打开的
Dialog
左侧选择所需列 - 然后在右侧从下拉列表中为列类型选择
DataGridViewAutoFilterTextBoxColumn
- Copy the
DataGridViewAutoFilter.dll
file to theBin
folder of the project concerned - Open
Visual Studio
, right click on theProject
concerned in theSolution Explorer
and select theAdd Reference
menu option from the opened Context menu - In the
Add Reference Dialog
select theBrowse
tab page and select theDataGridViewAutoFilter.dll
file by navigating to the folder in which it was copied - Now open the
Form
in design view, on which theDataGridView
is placed - Right click on the
DataGridView
and selectEdit columns
menu option from the opened context menu - In the opened
Dialog
select the required column on the left hand side - Then on the right hand side select the
DataGridViewAutoFilterTextBoxColumn
from the drop down list for the column type
我希望这可以达到目的.
I hope this may serve the purpose.
我已经解决了自己!谢谢!!!
I have solved myself!!! Thank You!!!
foreach (DataGridViewColumn col in dataGridView1.Columns)
{
col.HeaderCell = new DataGridViewAutoFilterColumnHeaderCell(col.HeaderCell);
}
dataGridView1.AutoResizeColumns();
这篇关于C#Win App中的DataGridView中的自动筛选-2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文