以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- TabContro 页面显示 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=187380) |
-- 作者:yaojun -- 发布时间:2023/7/13 14:23:00 -- TabContro 页面显示 Vars("yq") = 0 Dim t As C1Command.C1DockingTab = e.Form.Controls("TabControl1").BaseControl t.CanCloseTabs = True t.CloseBox = 1 AddHandler t.TabPageClosing, AddressOf _TabPageClosing 采用如上代码实现TabControl1页面显示关闭按钮,但是所有页面上都有了关闭按钮,能否第一个page“首页”不显示呀,其它的都可以显示,谢谢 |
-- 作者:有点蓝 -- 发布时间:2023/7/13 14:26:00 -- 不能的 |
-- 作者:yaojun -- 发布时间:2023/7/13 14:47:00 -- 那如果是打开的时候只显示首页页面,其它的页面隐藏呢: Dim pg As WinForm.TabPage pg = Forms("窗口1").Controls("TabControl1").TabPages(1) pg = Forms("窗口1").Controls("TabControl1").TabPages(2) pg = Forms("窗口1").Controls("TabControl1").TabPages(3) pg.Visible = False 好像只能隐藏第二个 |
-- 作者:有点蓝 -- 发布时间:2023/7/13 14:48:00 -- pg = Forms("窗口1").Controls("TabControl1").TabPages(1) pg.Visible = False pg = Forms("窗口1").Controls("TabControl1").TabPages(2) pg.Visible = False
|
-- 作者:yaojun -- 发布时间:2023/7/13 15:00:00 -- 非常好,谢谢蓝老师,那么现在通过TreeView1显示出来呢: Dim vals() As String = e.Node.FullName.Split("\\") For Each val As String In vals For Each c As WinForm.Control In e.Form.Controls If c.Gettype.Name = "TabControl" Then Dim tab As WinForm.TabControl = c If tab.TabPages.Contains(val) Then tab.SelectedPage = tab.TabPages(val) End If End If Next Next 这个代码是选取,怎样改成显示,谢谢 |
-- 作者:有点蓝 -- 发布时间:2023/7/13 15:09:00 -- If tab.TabPages.Contains(val) Then tab.TabPages(val).Visible = true End If
|
-- 作者:yaojun -- 发布时间:2023/7/13 15:28:00 -- 这样是可以显示隐藏的,但是通过关闭按钮关闭的显示不出来 afterload:
If User.Name = "开发者" Then DataTables("表B").LoadFilter = "" Else DataTables("表B").LoadFilter = "姓名 = \'" & User.Name & "\'" End If DataTables("表B").Load() \'e.Form.Controls("TreeView1").BuildTree("表B", "页面|任务") Dim tv As WinForm.TreeView tv = e.Form.Controls("TreeView1") tv.BuildTree("表B", "页面|任务", "", "页面,排序") Vars("yq") = 0 Dim t As C1Command.C1DockingTab = e.Form.Controls("TabControl1").BaseControl t.CanCloseTabs = True t.CloseBox = 1 AddHandler t.TabPageClosing, AddressOf _TabPageClosing Dim pg As WinForm.TabPage pg = Forms("窗口1").Controls("TabControl1").TabPages(1) pg.Visible = False pg = Forms("窗口1").Controls("TabControl1").TabPages(2) pg.Visible = False pg = Forms("窗口1").Controls("TabControl1").TabPages(3) pg.Visible = False pg = Forms("窗口1").Controls("TabControl1").TabPages(4) pg.Visible = False TreeView1的NodeMouseClick: Dim vals() As String = e.Node.FullName.Split("\\") For Each val As String In vals For Each c As WinForm.Control In e.Form.Controls If c.Gettype.Name = "TabControl" Then Dim tab As WinForm.TabControl = c If tab.TabPages.Contains(val) Then tab.TabPages(val).Visible = True End If End If Next Next [此贴子已经被作者于2023/7/13 15:31:18编辑过]
|
-- 作者:有点蓝 -- 发布时间:2023/7/13 15:48:00 -- 这种开启关闭按钮的用法,关闭的页面是无法再显示的,因为不是隐藏,而是直接移除删除掉了,关闭的页面已经不存在。 |
-- 作者:cd_tdh -- 发布时间:2023/7/14 8:56:00 -- 你这样做不是办法,论坛有专门的页签的案例啊 [此贴子已经被作者于2023/7/14 8:56:53编辑过]
|