Foxtable(狐表)用户栏目专家坐堂 → 遍历控件时FileManager 文件管理器的处理


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

主题:遍历控件时FileManager 文件管理器的处理

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


加好友 发短信
等级:六尾狐 帖子:1368 积分:12189 威望:0 精华:0 注册:2012/3/5 11:32:00
遍历控件时FileManager 文件管理器的处理  发帖心情 Post By:2015/10/14 10:12:00 [只看该作者]

 

 

我用遍历控件的方法 查阅 控件

 

先判断

排除了    .FileManager   这个文件管理器  ,

 

     If  TypeOf c Is WinForm.FileManager   Then

     end if

 

但在遍历控件的过程中,提示找不到

打开,增加 ,删除 等的控件

 

这些  应该是 FileManager 里面的东东,

 

如何排除这些东西呢??


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/10/14 10:19:00 [只看该作者]

1、贴出你的代码;

 

2、遍历,是不会遍历控件里面的控件的。


 回到顶部
帅哥哟,离线,有人找我吗?
ljh29206
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1368 积分:12189 威望:0 精华:0 注册:2012/3/5 11:32:00
  发帖心情 Post By:2015/10/14 10:22:00 [只看该作者]

Dim dr As DataRow

For Each f As WinForm.Form In forms

    If f.Opened = False Then Continue For

   

   

    dr = DataTables("Language").find("[中文] = '" & f.text & "'")

    If dr IsNot Nothing

        f.text = dr(getConfigValue("LangC", "英文"))

    End If

    dr = DataTables("Language").find("[英文] = '" & f.text & "'")

    If dr IsNot Nothing

        f.text = dr(getConfigValue("LangC", "中文"))

    End If

   

    For Each c As Winform.Control In f.Controls

        If TypeOf c Is Winform.NavBar Then

            Dim bar As WinForm.NavBar = f.Controls(c.name)

            For Each nb As WinForm.NavPage In bar.NavPages

                dr = DataTables("Language").find("[英文] = '" & nb.ButtonText & "'")

                If dr IsNot Nothing

                    nb.Buttontext = dr(getConfigValue("LangC", "中文"))

                End If

                dr = DataTables("Language").find("[中文] = '" & nb.ButtonText & "'")

                If dr IsNot Nothing

                    nb.Buttontext = dr(getConfigValue("LangC", "英文"))

                End If

            Next

 

        Else If Typeof c Is WinForm.TopicBar Then

            Dim trv As WinForm.TopicBar  = f.Controls(c.name)

            For Each page As WinForm.TopicPage In trv.Pages

            For Each nd As WinForm.TopicLink In page.Links

                dr = DataTables("Language").find("[英文] = '" & nd.Text & "'")

                If dr IsNot Nothing

                    nd.text = dr(getConfigValue("LangC", "中文"))

                End If

                dr = DataTables("Language").find("[中文] = '" & nd.Text & "'")

                If dr IsNot Nothing

                    nd.text = dr(getConfigValue("LangC", "英文"))

                End If

            Next

            Next

        Else If Typeof c Is WinForm.TreeView Then

            Dim trv As WinForm.TreeView = f.Controls(c.name)

            For Each nd As WinForm.TreeNode In trv.AllNodes

                dr = DataTables("Language").find("[英文] = '" & nd.text & "'")

                If dr IsNot Nothing

                    nd.text = dr(getConfigValue("LangC", "中文"))

                End If

                dr = DataTables("Language").find("[中文] = '" & nd.text & "'")

                If dr IsNot Nothing

                    nd.text = dr(getConfigValue("LangC", "英文"))

                End If

            Next

        Else If TypeOf c Is WinForm.TabControl Then

            Dim tc As WinForm.TabControl = f.Controls(c.name)

            For Each pg As WinForm.TabPage In tc.TabPages

                dr = DataTables("Language").find("[英文] = '" & pg.Text & "'")

                If dr IsNot Nothing

                    pg.text = dr(getConfigValue("LangC", "中文"))

                End If

                dr = DataTables("Language").find("[中文] = '" & pg.Text & "'")

                If dr IsNot Nothing

                    pg.text = dr(getConfigValue("LangC", "英文"))

                End If

            Next

 

        Else If TypeOf c Is WinForm.Panel OrElse TypeOf c Is WinForm.picturebox  OrElse TypeOf c Is WinForm.Table OrElse TypeOf c Is WinForm.line  _

         OrElse TypeOf c Is WinForm.WebBrowser OrElse TypeOf c Is WinForm.FileManager  OrElse TypeOf c Is WinForm.SplitContainer Then

        Else

            Dim ct As String = f.Controls(c.name).text

            dr = DataTables("Language").find("[英文] = '" & ct & "'")

            If dr IsNot Nothing

                f.Controls(c.name).text = dr(getConfigValue("LangC", "中文"))

            End If

            dr = DataTables("Language").find("[中文] = '" & ct & "'")

            If dr IsNot Nothing

                f.Controls(c.name).text = dr(getConfigValue("LangC", "英文"))

            End If

        End If

    Next

Next

 

 

在窗体 出现 有 FileManager  文件管理器的时候

提示 找不到  add open  等 的控件。


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/10/14 10:27:00 [只看该作者]

加入msgbox看哪里出错。

 

做简单例子上来测试


 回到顶部
帅哥哟,离线,有人找我吗?
ljh29206
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1368 积分:12189 威望:0 精华:0 注册:2012/3/5 11:32:00
  发帖心情 Post By:2015/10/14 10:37:00 [只看该作者]

老师请看

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.table


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/10/14 10:48:00 [只看该作者]

Dim dr As DataRow
For Each f As WinForm.Form In forms
    If f.Opened = False Then Continue For
   
    dr = DataTables("Language").find("[中文] = '" & f.text & "'")
    If dr IsNot Nothing
        f.text = dr(getConfigValue("LangC", "英文"))
    End If
    dr = DataTables("Language").find("[英文] = '" & f.text & "'")
    If dr IsNot Nothing
        f.text = dr(getConfigValue("LangC", "中文"))
    End If
   
    For Each c As object In f.Controls
        If TypeOf c Is Winform.NavBar Then
            Dim bar As WinForm.NavBar = f.Controls(c.name)
            For Each nb As WinForm.NavPage In bar.NavPages
                dr = DataTables("Language").find("[英文] = '" & nb.ButtonText & "'")
                If dr IsNot Nothing
                    nb.Buttontext = dr(getConfigValue("LangC", "中文"))
                End If
                dr = DataTables("Language").find("[中文] = '" & nb.ButtonText & "'")
                If dr IsNot Nothing
                    nb.Buttontext = dr(getConfigValue("LangC", "英文"))
                End If
            Next
           
        Else If Typeof c Is WinForm.TopicBar Then
            Dim trv As WinForm.TopicBar  = f.Controls(c.name)
            For Each page As WinForm.TopicPage In trv.Pages
                For Each nd As WinForm.TopicLink In page.Links
                    dr = DataTables("Language").find("[英文] = '" & nd.Text & "'")
                    If dr IsNot Nothing
                        nd.text = dr(getConfigValue("LangC", "中文"))
                    End If
                    dr = DataTables("Language").find("[中文] = '" & nd.Text & "'")
                    If dr IsNot Nothing
                        nd.text = dr(getConfigValue("LangC", "英文"))
                    End If
                Next
            Next
        Else If Typeof c Is WinForm.TreeView Then
            Dim trv As WinForm.TreeView = f.Controls(c.name)
            For Each nd As WinForm.TreeNode In trv.AllNodes
                dr = DataTables("Language").find("[英文] = '" & nd.text & "'")
                If dr IsNot Nothing
                    nd.text = dr(getConfigValue("LangC", "中文"))
                End If
                dr = DataTables("Language").find("[中文] = '" & nd.text & "'")
                If dr IsNot Nothing
                    nd.text = dr(getConfigValue("LangC", "英文"))
                End If
            Next
        Else If TypeOf c Is WinForm.TabControl Then
            Dim tc As WinForm.TabControl = f.Controls(c.name)
            For Each pg As WinForm.TabPage In tc.TabPages
                dr = DataTables("Language").find("[英文] = '" & pg.Text & "'")
                If dr IsNot Nothing
                    pg.text = dr(getConfigValue("LangC", "中文"))
                End If
                dr = DataTables("Language").find("[中文] = '" & pg.Text & "'")
                If dr IsNot Nothing
                    pg.text = dr(getConfigValue("LangC", "英文"))
                End If
            Next
           
        Else If TypeOf c Is WinForm.Panel OrElse TypeOf c Is WinForm.picturebox  OrElse TypeOf c Is WinForm.Table OrElse TypeOf c Is WinForm.line  _
            OrElse TypeOf c Is WinForm.WebBrowser OrElse TypeOf c Is WinForm.FileManager  OrElse TypeOf c Is WinForm.SplitContainer Then
           
           
        Else
            Dim ct As String = c.text
            dr = DataTables("Language").find("[英文] = '" & ct & "'")
            If dr IsNot Nothing
                c.text = dr(getConfigValue("LangC", "中文"))
            End If
            dr = DataTables("Language").find("[中文] = '" & ct & "'")
            If dr IsNot Nothing
                c.text = dr(getConfigValue("LangC", "英文"))
            End If
        End If
    Next
Next

 回到顶部
帅哥哟,离线,有人找我吗?
ljh29206
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1368 积分:12189 威望:0 精华:0 注册:2012/3/5 11:32:00
  发帖心情 Post By:2015/10/14 11:05:00 [只看该作者]

老师

 

c.text

f.controls(c.name).text

 

应该是一样的吧!

 

没搞懂 这2者的区别在哪里!


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/10/14 11:57:00 [只看该作者]

不一样。foxtable限制了controls直接取某控件。


 回到顶部