using DevExpress.Utils; using DevExpress.XtraTab; using Lskj.Business.Impl; using Lskj.Model; using Lskj.Util; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Lskj.PubTabDll { public partial class TabDllEx : UserControl { public TabDllEx() { InitializeComponent(); } public void InitTabPages(string[] gridDetail) { foreach (string item in gridDetail) { if (string.IsNullOrWhiteSpace(item)) continue; DataRow dataRow= MainImpl.GetModuleInformation(item); if (dataRow == null) continue; // 验证权限 int purview = MainImpl.GetUserPurviewsByMenuId(dataRow["MenuId"] + ""); if (purview == 0) continue; string[] args = new string[]{ dataRow["MenuCaption"] + "", ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, purview + "", dataRow["UrlParams"] + "", dataRow["MenuId"] + "" }; XtraTabPage tp = new XtraTabPage(); IForm iform = FormHelper.LoadDllForm(dataRow["DllFileName"] + "", args); iform.SubForm.WindowState = FormWindowState.Normal; ; Form form = iform.SubForm; // 表示组成应用程序的用户界面的窗口或对话框。 form.Tag = item; // 这个必须有不然会提示:"不能向tabControl中添加顶级控件" form.TopLevel = false; form.Dock = DockStyle.Fill;//客户需要缩放 form.AutoSize = true; form.FormBorderStyle = FormBorderStyle.None; tp.Text = dataRow["MenuCaption"] + ""; //tp.Tag = guid; tp.AutoScroll = true; tp.Controls.Add(form); tp.ShowCloseButton = DefaultBoolean.True; tp.Dock = DockStyle.Fill; form.Show(); this.xtraTabControl.TabPages.Add(tp); } this.xtraTabControl.SelectedTabPageIndex = 0; } } }