/// <summary> /// 弹出页面 /// </summary> /// <param name="page"></param> public static void Show(LBUIPageBase page, bool bolIsTopLevel) { LBForm form = new Controls.LBForm(page); form.TopLevel = bolIsTopLevel; form.Show(); }
/// <summary> /// 不弹出界面,在主界面显示 /// </summary> /// <param name="page"></param> public static LBUIPageBase GetPageByType(int PageTypeID, Dictionary <string, object> pageParm) { PageEventArgs args = new Controls.Args.PageEventArgs(PageTypeID, pageParm); GetPageEvent(args); LBUIPageBase page = args.PageResult; if (page == null) { throw new Exception("页面好[" + PageTypeID + "]不存在!"); } return(page); }
private void TcMain_TabPageClosedEvent(object sender, Controls.Args.TabPageClosedEventArgs e) { try { TabPage tpCurrent = e.TabPageClose as TabPage; if (tpCurrent.Tag is LBUIPageBase) { LBUIPageBase pageBase = tpCurrent.Tag as LBUIPageBase; //pageBase.Dispose(); } } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
private void TcMain_TabPageClosingEvent(object sender, Controls.Args.TabPageClosingEventArgs e) { try { TabPage tpCurrent = e.TabPageClose as TabPage; if (tpCurrent.Tag is LBUIPageBase) { LBUIPageBase pageBase = tpCurrent.Tag as LBUIPageBase; bool bolCancel = false; pageBase.StartClose(out bolCancel); } } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
private void TpTp1_SizeChanged(object sender, EventArgs e) { try { DMSkin.Metro.Controls.MetroTabPage tpCurrent = sender as DMSkin.Metro.Controls.MetroTabPage; if (tpCurrent.Tag is LBUIPageBase) { LBUIPageBase pageBase = tpCurrent.Tag as LBUIPageBase; pageBase.Size = new Size(tpCurrent.Width, tpCurrent.Height); } } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
private void Uipagebase_FormClosed(object sender, FormClosedEventArgs e) { try { LBUIPageBase Uipagebase = sender as LBUIPageBase; if (Uipagebase.RefTabPage != null) { if (this.tcMain.TabPages.Contains(Uipagebase.RefTabPage)) { Uipagebase.Dispose(); this.tcMain.TabPages.Remove(Uipagebase.RefTabPage); } } } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
private void LBShowForm_LBUIPageBaseAdded(object sender, EventArgs e) { int iMaxIndex = 0; foreach (DMSkin.Metro.Controls.MetroTabPage tp in this.tcMain.TabPages) { if (tp.TabIndex > iMaxIndex) { iMaxIndex = tp.TabIndex; } } LBUIPageBase Uipagebase = sender as LBUIPageBase; Uipagebase.FormClosed += Uipagebase_FormClosed; string strTabTitle = Uipagebase.LBPageTitle == "" ? Uipagebase.Name : Uipagebase.LBPageTitle; DMSkin.Metro.Controls.MetroTabPage tpTp1 = new DMSkin.Metro.Controls.MetroTabPage(); tpTp1.Name = Uipagebase.Name; tpTp1.BackColor = System.Drawing.Color.White; //tpTp1.Dock = System.Windows.Forms.DockStyle.Fill; Graphics g = this.CreateGraphics(); SizeF size = g.MeasureString(strTabTitle, this.tcMain.Font); tpTp1.Size = new System.Drawing.Size((int)size.Width + 20, 316); tpTp1.TabIndex = iMaxIndex + 1; tpTp1.Text = Uipagebase.LBPageTitle == ""? Uipagebase.Name: Uipagebase.LBPageTitle; tpTp1.Tag = Uipagebase; this.tcMain.TabPages.Add(tpTp1); Uipagebase.Size = new Size(tpTp1.Width, tpTp1.Height); Uipagebase.Location = new Point(1, 1); tpTp1.Controls.Add(Uipagebase); this.tcMain.SelectedTab = tpTp1; tpTp1.Invalidate(); tpTp1.SizeChanged += TpTp1_SizeChanged; Uipagebase.Invalidate(); Uipagebase.RefTabPage = tpTp1; }
/// <summary> /// 不弹出界面,在主界面显示 /// </summary> /// <param name="page"></param> public static void ShowMainPage(LBUIPageBase page) { LBUIPageBaseAdded?.Invoke(page, null); }
/// <summary> /// 弹出页面 /// </summary> /// <param name="page"></param> public static void ShowDialog(LBUIPageBase page) { LBForm form = new Controls.LBForm(page); form.ShowDialog(); }