C#Win App中的DataGridView中的自动筛选-2 [英] AutoFilter in DataGridView in C# Win App - 2

查看:389
本文介绍了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 中使用,如下所示:
The DataGridViewAutoFilterTextBoxColumn can be used in the DataGridView as shown below:

  1. DataGridViewAutoFilter.dll文件复制到相关项目的Bin文件夹中
  2. 打开Visual Studio,右键单击Solution Explorer中相关的Project ,然后选择Add Reference从打开的上下文菜单中选择菜单选项
  3. Add Reference Dialog中选择Browse 选项卡页,然后通过导航到DataGridViewAutoFilter.dll 文件并复制到其中的文件夹来选择该文件
  4. 现在,在设计视图中打开Form ,在其上放置DataGridView
  5. 右键单击DataGridView,然后从打开的上下文菜单中选择Edit columns菜单选项
  6. 在打开的Dialog 左侧选择所需列
  7. 然后在右侧从下拉列表中为列类型选择DataGridViewAutoFilterTextBoxColumn

  1. Copy the DataGridViewAutoFilter.dll file to the Bin folder of the project concerned
  2. Open Visual Studio, right click on the Project concerned in the Solution Explorer and select the Add Reference menu option from the opened Context menu
  3. In the Add Reference Dialog select the Browse tab page and select the DataGridViewAutoFilter.dll file by navigating to the folder in which it was copied
  4. Now open the Form in design view, on which the DataGridView is placed
  5. Right click on the DataGridView and select Edit columns menu option from the opened context menu
  6. In the opened Dialog select the required column on the left hand side
  7. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆