Foxtable(狐表)用户栏目专家坐堂 → [分享]Foxtable内置筛选器


  共有70233人关注过本帖树形打印复制链接

主题:[分享]Foxtable内置筛选器

帅哥哟,离线,有人找我吗?
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:732 积分:5491 威望:0 精华:14 注册:2011/8/28 12:49:00
[分享]Foxtable内置筛选器  发帖心情 Post By:2012/2/12 15:46:00 [显示全部帖子]

尽管Foxtable的筛选功能已经足够健全,但是用过Excel2007以后版本的朋友是否觉得未能够使用那样的筛选功能有些遗憾呢?

呵呵,在项目事件AfterOpenProject事件中加入一行代码可以开启某个表的内置筛选功能,如下图片所示:

 

Tables("行政区域").Grid.AllowFiltering = True

 


此主题相关图片如下:筛选器1.png
按此在新窗口浏览图片

此主题相关图片如下:筛选器2.png
按此在新窗口浏览图片

但是在很多传统的企业尤其是制造型的企业中,管理层的年龄偏大,也就是说不可能每个人都懂英文的,

因为这个筛选器是表控件自带的功能,所以看起来有些吃力,怎么办呢?

 

不要急,在功能区管理项目选项卡中点击计划管理按钮,打开计划管理,添加一个计划,间隔300(也可以自行设置),然后加入以下代码

 

On Error Resume Next

Dim MyForm As Windows.Forms.Form = Windows.Forms.Form.ActiveForm

If MyForm Is Nothing Then Return

If MyForm.Name = "FilterEditorForm" Then

    With MyForm.Controls("ColumnFilterEditor").Controls("_conditionFilterEditor")

        If .Controls("_label").Text = "按以下条件显示行" Then Return

        .Controls("_label").Text = "按以下条件显示行"

        .Controls("_btnOr").Text = ""

        .Controls("_btnAnd").Text = ""

        Dim ArrText1 As String() = {"(Not Set)","Equals","Does Not Equals","Is Greater than","Is Less than","Is Greater than or Equal to","Is Less than or Equal to","Contains","Does Not Contain","Begins with","Ends with"}

        Dim ArrText2 As String() = {"(不设置)","等于","不等于","大于","小于","大于等于","小于等于","包含","不包含","开始于","结束于"}

        Dim MyCombo As Windows.Forms.ComboBox = .Controls("_cmbOp1")

        For i As Integer = 0 To Ubound(ArrText2 )

            MyCombo.Items(i) = ArrText2(i)

        Next

        MyCombo = .Controls("_cmbOp2")

        For i As Integer = 0 To Ubound(ArrText2 )

            MyCombo.Items(i) = ArrText2(i)

        Next

    End With

    Dim MyToolBar As Windows.Forms.ToolStrip = MyForm.Controls("_toolStrip")

    With MyToolBar

        .Items("_btnCancel").Text = "取消"

        .Items("_btnClearFilter").Text = "清除"

        .Items("_btnApplyFilter").Text = "筛选"

        .Items("_btnTextFilter").Text = "文本筛选"

        .Items("_btnDateTimeFilter").Text = "日期/时间筛选"

        .Items("_btnNumericFilter").Text = "数值筛选"

        .Items("_btnValueFilter").Text = "值筛选"

        Dim ToolBarSplitBtn As Windows.Forms.ToolStripSplitButton = .Items("_btnTextFilter")

        With ToolBarSplitBtn.DropDownItems

            .Item("_mnuEquals").Text = "等于"

            .Item("_mnuDoesNotEqual").Text = "不等于"

            .Item("_mnuBeginsWith").Text = "开始于"

            .Item("_mnuEndsWith").Text = "结束于"

            .Item("_mnuContains").Text = "包含"

            .Item("_mnuDoesNotContain").Text = "不包含"

            .Item("_mnuGreaterThan").Text = "大于"

            .Item("_mnuGreaterThanOrEqualTo").Text = "大于等于"

            .Item("_mnuLessThan").Text = "小于"

            .Item("_mnuLessThanOrEqualTo").Text = "小于等于"

            .Item("_mnuBetween").Text = "介于"

        End With

    End With

End If

 

 

 

呵呵,见识奇迹的时刻到了..........

 


此主题相关图片如下:筛选器3.png
按此在新窗口浏览图片

此主题相关图片如下:筛选器4.png
按此在新窗口浏览图片

 

 下载信息  [文件大小:   下载次数: ]
点击浏览该文件:内置筛选器.rar

 

 

以下广告:

求职:http://www.foxtable.com/bbs/dispbbs.asp?boardid=6&Id=16267

本人Foxtable技术交流QQ群:198855045

[此贴子已经被作者于2012-6-21 23:02:50编辑过]

[本帖被加为精华]
 回到顶部