以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]页面添加主表 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=121980) |
-- 作者:blsu33 -- 发布时间:2018/7/16 20:39:00 -- [求助]页面添加主表 老师, 目录树,单击目录树按钮,就会在页面上添加页面,并在页面上添加表(主表),但是发现偶尔 页面上没有表显示出来,为什么呢? NodeMouseClick SystemReady = False If e.Node.Level=0 Then e.Sender.CollapseAll If e.Node.IsExpanded=False Then e.Node.ExpandAll End If End If If e.Node.Nodes.Count=0 Then e.Form.StopRedraw Dim tab As WinForm.TabControl = e.Form.Controls("tbl_jd_serevmain_serevmain") e.Form.Controls("tbl_jd_serevmain_serevmain").Basecontrol.borderstyle = Windows.Forms.FormBorderStyle.None\'去掉边框 Dim pg As WinForm.TabPage \'添加导航按钮 Dim bttitle As String=e.Node.Name Dim btNames As New List(Of String) btNames.Clear Dim pnl As WinForm.Panel=Forms("serevmain").controls("pnl_serevmain_serevmain") For Each c As object In pnl.Children If Typeof c Is WinForm.Panel Then btNames.Add(c.name) c.backColor = Color.lightblue End If Next Dim btn As object If tab.TabPages.Contains("pg_serevmain_" & e.Node.Name) = False Then \'添加页面 tab.TabPages.Add("pg_serevmain_" & e.Node.Name,e.Node.Name) PG=tab.SelectedPage pg.Visible=False If pg IsNot Nothing Then If e.Form.ExistControl("tab_serevmain_" & e.Node.Name) Then e.Form.RemoveControl("tab_serevmain_" & e.Node.Name) Else Dim tbl As WinForm.Table tbl= e.Form.CreateTable("tab_serevmain_" & e.Node.Name,e.Node.Name,False) tbl.Table.AllowEdit=False e.Form.AddControl(tbl) tbl.Table.Filter="" \'\'重新生成表头 Functions.Execute("za_nb_tablerename",tbl) Functions.Execute("za_nb_tableover",DataTables(e.Node.Name)) \'\'重新生成表头 \'tbl.Enabled=False tbl.Visible=False tbl.Table.DataTable.SysStyles("Alternate").BackColor=Color.LightGray tbl.Table.DataTable.SysStyles("EmptyArea").BackColor = Color.White tbl.Table.DataTable.SysStyles("CurrentRow").BackColor = Color.FloralWhite tbl.Table.DataTable.MultiRowHeader = False tbl.Table.ListMode = True tab.tabpages("pg_serevmain_" & e.Node.name).AddControl(tbl) tbl.dock=5 tbl.Visible=True \'添加页面 \'添加导航按钮 btn = Forms("serevmain").CreateControl("pnl_tit_serevmain_" & bttitle,ControlTypeEnum.Panel) btn.Visible = True btn.backColor = Color.GreenYellow btn.BaseControl.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None btn.BaseControl.dock=System.Windows.Forms.DockStyle.Left btn.BaseControl.anchor=System.Windows.Forms.AnchorStyles.Left btn.BaseControl.BackgroundImage = GetImage(Functions.Execute("za_nb_addtoplogo",btn,0,True)) btn.Dock = 3 btn.TopMost=True btn.width = 110\'下面还有一个110数字要一样 Dim la As WinForm.Label = Forms("serevmain").CreateControl("lab_tit_serevmain_" & e.Node.Name,ControlTypeEnum.Label) la.text = e.Node.text la.Top = 12 la.left =30 la.topMost=False la.Enabled=False la.AutoSize = True btn.AddControl(la) pnl.AddControl(btn) btn.Height = btn.parent.height pg.Visible=True \'添加导航按钮结束 End If End If Else pg=tab.tabpages("pg_serevmain_" & e.Node.name) tab.SelectedPage=PG If pg IsNot Nothing Then btn = Forms("serevmain").Controls("pnl_tit_serevmain_" & bttitle) btn.backColor = Color.GreenYellow btn.Dock = 3 btn.width = 110\'上面还有一个110数字要一样 pg.Visible=True End If End If
If vars("p_serevmain_pidx").Contains(bttitle) = False Then\'关闭再打开需要重新加载PAGE顺序使用 vars("p_serevmain_pidx").add(bttitle) Functions.Execute("za_nb_zaformset",e,e.Node.name) End If
E.Form.ResumeRedraw End If SystemReady = True |
-- 作者:blsu33 -- 发布时间:2018/7/16 20:53:00 -- 测试 了 下 的确 是表 没有加载进去 循环 显示 窗口中的控件 发现 对应的表 是没有的 If e.Form.ExistControl("tab_serevmain_" & e.Node.Name) Then e.Form.RemoveControl("tab_serevmain_" & e.Node.Name) Else 改为 If e.Form.ExistControl("tab_serevmain_" & e.Node.Name)=false Then ’ e.Form.RemoveControl("tab_serevmain_" & e.Node.Name) ’ Else 同样这样 |
-- 作者:有点蓝 -- 发布时间:2018/7/16 20:55:00 -- If e.Node.Nodes.Count=0 Then e.Form.StopRedraw Dim tab As WinForm.TabControl = e.Form.Controls("tbl_jd_serevmain_serevmain") e.Form.Controls("tbl_jd_serevmain_serevmain").Basecontrol.borderstyle = Windows.Forms.FormBorderStyle.None\'去掉边框 Dim pg As WinForm.TabPage \'添加导航按钮 Dim bttitle As String=e.Node.Name Dim btNames As New List(Of String) Dim pnl As WinForm.Panel=Forms("serevmain").controls("pnl_serevmain_serevmain") For Each c As object In pnl.Children If Typeof c Is WinForm.Panel Then btNames.Add(c.name) c.backColor = Color.lightblue End If Next Dim btn As object If tab.TabPages.Contains("pg_serevmain_" & e.Node.Name) = False Then \'添加页面 pg = tab.TabPages.Add("pg_serevmain_" & e.Node.Name,e.Node.Name) Dim tbl As WinForm.Table tbl= e.Form.CreateTable("tab_serevmain_" & e.Node.Name,e.Node.Name,False) tbl.Table.AllowEdit=False e.Form.AddControl(tbl) tbl.Table.Filter="" \'\'重新生成表头 Functions.Execute("za_nb_tablerename",tbl) Functions.Execute("za_nb_tableover",DataTables(e.Node.Name)) \'\'重新生成表头 \'tbl.Enabled=False tbl.Visible=False tbl.Table.DataTable.SysStyles("Alternate").BackColor=Color.LightGray tbl.Table.DataTable.SysStyles("EmptyArea").BackColor = Color.White tbl.Table.DataTable.SysStyles("CurrentRow").BackColor = Color.FloralWhite tbl.Table.DataTable.MultiRowHeader = False tbl.Table.ListMode = True tbl.dock=5 tbl.Visible=True pg.AddControl(tbl) tab.SelectedPage=PG \'添加页面 \'添加导航按钮 btn = Forms("serevmain").CreateControl("pnl_tit_serevmain_" & bttitle,ControlTypeEnum.Panel) btn.Visible = True btn.backColor = Color.GreenYellow btn.BaseControl.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None btn.BaseControl.dock=System.Windows.Forms.DockStyle.Left btn.BaseControl.anchor=System.Windows.Forms.AnchorStyles.Left btn.BaseControl.BackgroundImage = GetImage(Functions.Execute("za_nb_addtoplogo",btn,0,True)) btn.Dock = 3 btn.TopMost=True btn.width = 110\'下面还有一个110数字要一样 Dim la As WinForm.Label = Forms("serevmain").CreateControl("lab_tit_serevmain_" & e.Node.Name,ControlTypeEnum.Label) la.text = e.Node.text la.Top = 12 la.left =30 la.topMost=False la.Enabled=False la.AutoSize = True btn.AddControl(la) pnl.AddControl(btn) btn.Height = btn.parent.height pg.Visible=True \'添加导航按钮结束 End If Else pg=tab.tabpages("pg_serevmain_" & e.Node.name) tab.SelectedPage=PG If pg IsNot Nothing Then btn = Forms("serevmain").Controls("pnl_tit_serevmain_" & bttitle) btn.backColor = Color.GreenYellow btn.Dock = 3 btn.width = 110\'上面还有一个110数字要一样 pg.Visible=True End If End If If vars("p_serevmain_pidx").Contains(bttitle) = False Then\'关闭再打开需要重新加载PAGE顺序使用 vars("p_serevmain_pidx").add(bttitle) Functions.Execute("za_nb_zaformset",e,e.Node.name) End If E.Form.ResumeRedraw End If
|