以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- .net2.0升级到4.0错误 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=141657) |
-- 作者:lshshlxsh -- 发布时间:2019/10/8 10:12:00 -- .net2.0升级到4.0错误 请老师帮忙看一下 软件升级到最新版后 之前定义(红色部分)的都不能用了 Public Function FindWindow(ByVal Title As String) As System.Windows.Forms.Form Dim frmFormManager As System.Windows.Forms.Form For Each frm As System.Windows.Forms.Form In Application.OpenForms If frm.Text=Title Then frmFormManager=frm frm.BringToFront Return frm End If Next Return Nothing End Function Public Sub GetNode(ByVal strWinName As String, ByRef lstNodes As System.Windows.Forms.TreeNodeCollection) For Each tNode As System.Windows.Forms.TreeNode In lstNodes If tNode.Text = strWinName Then tNode.TreeView.SelectedNode = tNode Exit For End If GetNode(strWinName, tNode.Nodes) Next End Sub Public Sub FindAndShowWindow(ByVal strFormName As String) Dim frmManager As System.Windows.Forms.Form=FindWindow("窗口管理") If frmManager Is Nothing Then frmManager=New FormsManager() Dim intTop As Integer Dim trv As System.Windows.Forms.TreeView = frmManager.controls("TreeView1") trv.Dock= System.Windows.Forms.DockStyle.None trv.Anchor= System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Top intTop= trv.Top trv.Top=trv.Top+28 trv.Height=trv.Height-30 \'trv.Bottom=3 Dim txtFilter As New System.Windows.Forms.TextBox txtFilter.Name="txtFormFilter" txtFilter.Top=intTop txtFilter.Left= trv.Left txtFilter.Width=200 frmManager.Controls.Add(txtFilter) Dim btnFindNext As New System.Windows.Forms.Button btnFindNext.Name="btnFindNext" btnFindNext.Text="下一个" btnFindNext.Top=intTop btnFindNext.Left= txtFilter.Left+ txtFilter.Width +5 AddHandler btnFindNext.Click,AddressOf btnNextForm_Click frmManager.Controls.Add(btnFindNext) If strFormName IsNot Nothing AndAlso strFormName.Length>0 Then GetNode(strFormName,trv.Nodes) End If frmManager.Owner= BaseMainForm frmManager.ShowDialog() Else Dim trv As System.Windows.Forms.TreeView = frmManager.controls("TreeView1") If strFormName IsNot Nothing AndAlso strFormName.Length>0 Then GetNode(strFormName,trv.Nodes) End If frmManager.BringToFront End If End Sub Public Sub btnNextForm_Click(sender As Object, e As EventArgs) Dim btnFind As System.Windows.Forms.Button=CType(Sender,System.Windows.Forms.Button) Dim frmManager As System.Windows.Forms.Form= btnFind.FindForm Dim txtFormFilter As System.Windows.Forms.TextBox=CType(frmManager.controls("txtFormFilter"),System.windows.Forms.TextBox) Dim strName As String = txtFormFilter.Text If strName = "" Then Return End If Dim trv As System.Windows.Forms.TreeView = CType(frmManager.controls("TreeView1"),System.windows.Forms.TreeView) Dim Start As Integer Dim idx As Integer = -1 Dim firstNode As System.Windows.Forms.TreeNode = Nothing Dim _SelectNode As System.Windows.Forms.TreeNode= trv.SelectedNode Dim blnFindPre As Boolean = False \'标记是否在选择节点前发现Node Dim blnPre As Boolean = True \'表示目前在选择节点前搜索 If _SelectNode IsNot Nothing Then Dim FullName As String = _SelectNode.FullPath For Each nd As System.Windows.Forms.TreeNode In trv.Nodes If nd.Text.ToUpper.Contains(strName.ToUpper) Then If blnPre = True Then \'如果是在选择节点前 If blnFindPre = False Then \'如果没有找到过相应的结果 firstNode = nd blnFindPre = True End If Else \'如果是在选择节点后 nd.EnsureVisible() _SelectNode = nd trv.SelectedNode = nd trv.Select() Return End If End If If nd.FullPath = FullName Then blnPre = False Start = nd.Index End If If nd.Nodes.Count > 0 Then If CheckNextLevelNode(trv,nd, strName, FullName, Start, blnPre, blnFindPre, firstNode) = True Then \'如果找到对应的子节点则退出 If blnPre Then Continue For Else trv.Select() Return End If End If End If Next If blnFindPre AndAlso firstNode IsNot Nothing Then firstNode.EnsureVisible() trv.SelectedNode = firstNode trv.Select() Return End If Else blnPre = False For Each nd As System.Windows.Forms.TreeNode In trv.Nodes If nd.Text.ToUpper.Contains(strName.ToUpper) Then nd.EnsureVisible() trv.SelectedNode = nd trv.Select() Return End If If nd.Nodes.Count > 0 Then If CheckNextLevelNode(trv,nd, strName, "", Start, blnPre, blnFindPre, firstNode) = True Then \'如果找到对应的子节点则退出 trv.Select() Return End If End If Next End If trv.Select() End Sub Private Function CheckNextLevelNode(ByRef trv As System.Windows.Forms.TreeView, ByRef ndFather As System.Windows.Forms.TreeNode, ByVal strName As String, ByVal FullName As String, ByRef Start As Integer, ByRef blnPre As Boolean, ByRef blnFindPre As Boolean, ByRef firstNode As System.Windows.Forms.TreeNode) As Boolean For Each nd As System.Windows.Forms.TreeNode In ndFather.Nodes If nd.Text.ToUpper.Contains(strName.ToUpper) Then If blnPre = True Then \'如果是在选择节点前 If blnFindPre = False Then \'如果没有找到过相应的结果 firstNode = nd blnFindPre = True End If Else \'如果是在选择节点后 nd.EnsureVisible() trv.SelectedNode = nd Return True End If End If If nd.FullPath = FullName Then blnPre = False Start = nd.Index End If If nd.Nodes.Count > 0 Then If CheckNextLevelNode(trv,nd, strName, FullName, Start, blnPre, blnFindPre, firstNode) = True Then \'如果找到对应的子节点则退出 Return True End If End If Next Return False End Function |
-- 作者:有点蓝 -- 发布时间:2019/10/8 10:32:00 -- 这个类型被混淆了。Foxtable不能也无法保证底层的不公开的类型是可用的 |
-- 作者:lshshlxsh -- 发布时间:2019/10/8 10:45:00 -- 希望官方 增加 窗口查找功能 窗口太多了 都不知道在哪个位置 |
-- 作者:blackzhu -- 发布时间:2019/10/8 13:16:00 -- 以下是引用lshshlxsh在2019/10/8 10:45:00的发言: 希望官方 增加 窗口查找功能 窗口太多了 都不知道在哪个位置 这个代码我也屏蔽了,窗口可以通过窗口管理自带的目录树来管理
|
-- 作者:tennis -- 发布时间:2019/10/12 8:13:00 -- 请狐表多关注狐友的心声,不要老是用 "这个类型被混淆了。Foxtable不能也无法保证底层的不公开的类型是可用的" 搪塞,狐友反应这个功能已久,也确实对后续维护很重要;不但不改善还限制了狐友;这软件怎登大雅之堂;不然也告知狐友们该如何作!! |