コード例 #1
0
ファイル: FrmMain.cs プロジェクト: radtek/smartaccess
        public void AddControl(Control ctrl, string title, Image image = null)
        {
            //
            // superTabItem
            //
            SuperTabItem         superTabItem         = new SuperTabItem();
            SuperTabControlPanel superTabControlPanel = new SuperTabControlPanel();

            superTabItem.AttachedControl    = superTabControlPanel;
            superTabItem.CloseButtonVisible = true;
            superTabItem.GlobalItem         = false;
            if (image == null)
            {
                image = Properties.Resources.editor;
            }
            superTabItem.Image = image;
            superTabItem.Text  = title;
            //
            // superTabControlPanel
            //
            ctrl.Dock = DockStyle.Fill;
            superTabControlPanel.Controls.Add(ctrl);
            superTabControlPanel.Dock = System.Windows.Forms.DockStyle.Fill;
            //superTabControlPanel.Location = new System.Drawing.Point(0, 28);
            //superTabControlPanel.Size = new System.Drawing.Size(764, 608);
            superTabControlPanel.TabItem = superTabItem;
            this.superTabControl.Controls.Add(superTabControlPanel);

            this.superTabControl.Tabs.Add(superTabItem);
            this.superTabControl.SelectedTab = superTabItem;
        }
コード例 #2
0
        /// <summary>
        /// 按照内容类型查找Tab
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="createIfNull">如果没有找到,是否新建</param>
        /// <param name="active">如果已找到,是否激活</param>
        /// <returns></returns>
        public SuperTabItem FindTabByContentType <T>(bool createIfNull = false, bool active = false) where T : ControlBase, new()
        {
            var tab = st.Tabs.OfType <SuperTabItem>().FirstOrDefault(s => s.AttachedControl != null && s.AttachedControl.GetType() == typeof(T));

            if (tab == null && createIfNull)
            {
                var control = new T()
                {
                    Dock = DockStyle.Fill
                };
                tab = new SuperTabItem
                {
                    AttachedControl = control,
                    Text            = control.Text,
                    Image           = control.Image
                };
                st.Tabs.Add(tab);
            }

            if (active && tab != null)
            {
                st.SelectedTab = tab;
            }

            return(tab);
        }
コード例 #3
0
ファイル: FormMain.cs プロジェクト: 0000duck/MES-3
        public void SetMdiForm(string caption, Type formType, object[] objArgs = null)
        {
            var tab = superTabControlMain.Tabs.Cast <SuperTabItem>().FirstOrDefault(x => x.Text == caption && x.AttachedControl.GetType() == formType);

            //如果在现有Tab页面中没有找到,那么就要初始化了Tab页面了
            if (tab == null)
            {
                if (formType == null)
                {
                    return;
                }
                var form = Activator.CreateInstance(formType, objArgs) as Form;
                form.TopLevel        = false;
                form.FormBorderStyle = FormBorderStyle.Fixed3D;
                form.Dock            = DockStyle.Fill;
                //form.Visible = true;
                tab = new SuperTabItem
                {
                    Name            = caption,
                    Text            = caption,
                    AttachedControl = form
                };
                superTabControlMain.Tabs.Add(tab);
                superTabControlMain.SelectedTab = tab;
                superTabControlPanelMain.Controls.Add(form);
            }
            superTabControlMain.SelectedTab = tab;
        }
コード例 #4
0
        private void AddTabForm(string TabName, string TabPath, int authid = 0)
        {
            bool isopen = true;

            foreach (SuperTabItem item in sTC.Tabs)
            {
                if (item.Name == TabName)
                {
                    sTC.SelectedTab = item;
                    isopen          = false;
                    break;
                }
            }

            if (isopen)
            {
                object obj = Assembly.GetExecutingAssembly().CreateInstance("CS.UI." + TabPath, false);
                if (obj == null)
                {
                    MetroMessageBox.Show(this, "路径错误,请联系系统管理员。", "警告");
                    return;
                }
                Form form = (Form)obj;
                form.TopLevel = false;
                form.Visible  = true;
                form.Dock     = DockStyle.Fill;
                form.Tag      = authid;

                SuperTabItem item = sTC.CreateTab(TabName);
                item.Text = TabName;
                item.Name = TabName;
                item.AttachedControl.Controls.Add(form);
                sTC.SelectedTab = item;
            }
        }
コード例 #5
0
        /// <summary>
        /// 加载一个窗体到TabControl中
        /// </summary>
        /// <param name="form"></param>
        public void ShowChildForm(Office2007RibbonForm form, string TagName)
        {
            //判断是否在,如果存在,直接激活为当前Tab
            foreach (SuperTabItem it in MainSuperTabControl.Tabs)
            {
                if (it.Name == form.Name)
                {
                    MainSuperTabControl.SelectedTab = it;
                    return;
                }
            }
            //不存在,创建TabItem,并激活
            form.FormBorderStyle = FormBorderStyle.None;
            form.Dock            = DockStyle.Fill;
            //开始 liuxuexian
            //为了适应不同屏幕的分辨率,设置最小出现滚动条的值
            //form.AutoScroll = true;
            //form.AutoScrollMinSize = new Size(this.MainSuperTabControl.Width - 20, this.MainSuperTabControl.Height - 20);
            //结束
            form.TopLevel = false;
            form.Visible  = true;
            SuperTabItem item = MainSuperTabControl.CreateTab(form.Text);

            item.Text = TagName;
            item.Name = form.Name;
            item.AttachedControl.Controls.Add(form);
            MainSuperTabControl.SelectedTab = item;
        }
コード例 #6
0
        public void AddToTab(BaseForm mdiForm, string code, Image pageImage)
        {
            var tabItemNew         = new SuperTabItem();
            var tabControlPanelNew = new SuperTabControlPanel
            {
                AutoScroll = true,
                Dock       = DockStyle.Fill,
                Name       = code,
                TabItem    = tabItemNew
            };

            tabItemNew.AttachedControl = tabControlPanelNew;
            tabItemNew.Name            = code;
            mdiForm.FormClosed        += RemoveSelectedTab;
            mdiForm.FormBorderStyle    = FormBorderStyle.None;
            mdiForm.TopLevel           = false;
            mdiForm.Parent             = tabControlPanelNew;
            mdiForm.Dock = DockStyle.Fill;
            tabControlPanelNew.Controls.Add(mdiForm);
            mdiForm.Show();
            mdiForm.AutoSize = true;
            tabItemNew.Text  = mdiForm.Text;
            //tabItemNew.Image = buttomItem.Image;
            if (pageImage != null)
            {
                tabItemNew.Image = ImageHelper.Scale(pageImage, new Size(24, 24)); //把图标缩放到24*24的尺寸
            }
            tabControlMain.Controls.Add(tabControlPanelNew);
            tabControlMain.Tabs.Add(tabItemNew);
            tabControlMain.Refresh();
            tabControlMain.SelectedTab = tabItemNew;
        }
コード例 #7
0
        private void btn_TiepNhan_Click(object sender, EventArgs e)
        {
            if (Class.CompanyInfo.idcongty != "0") //60 - DongA
            {
                if (KiemTraTenTabConTrol("&Bảo dưỡng xe") == false)
                {
                    SuperTabItem Tab = superTabControl1.CreateTab("&Bảo dưỡng xe");

                    UcBaoDuong frm = new UcBaoDuong();
                    frm.Dock = DockStyle.Fill;
                    Tab.AttachedControl.Controls.Add(frm);
                    frm.Show();

                    superTabControl1.SelectedTabIndex = superTabControl1.Tabs.Count - 1;
                }
            }
            else
            {
                if (KiemTraTenTabConTrol("&Tiếp nhận xe") == false)
                {
                    SuperTabItem Tab = superTabControl1.CreateTab("&Tiếp nhận xe");

                    UcTiepNhanDongA frm = new UcTiepNhanDongA();
                    frm.Dock = DockStyle.Fill;
                    Tab.AttachedControl.Controls.Add(frm);
                    frm.Show();

                    superTabControl1.SelectedTabIndex = superTabControl1.Tabs.Count - 1;
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// 创建或者显示一个多文档界面页面
        /// </summary>
        /// <param name="caption">窗体标题</param>
        /// <param name="formType">窗体类型</param>
        public void SetMdiForm(string caption, Form form)
        {
            bool IsOpened = false;

            //遍历现有的Tab页面,如果存在,那么设置为选中即可
            foreach (SuperTabItem tabitem in NavTabControl1.Tabs)
            {
                if (tabitem.Name == caption)
                {
                    NavTabControl1.SelectedTab = tabitem;
                    IsOpened = true;
                    break;
                }
            }
            //如果在现有Tab页面中没有找到,那么就要初始化了Tab页面了
            if (!IsOpened)
            {
                SuperTabItem tabItem = NavTabControl1.CreateTab(caption);
                tabItem.Name         = caption;
                tabItem.Text         = caption;
                form.FormBorderStyle = FormBorderStyle.None;
                form.TopLevel        = false;
                form.Visible         = true;
                form.Dock            = DockStyle.Fill;
                //tabItem.Icon = form.Icon;
                tabItem.AttachedControl.Controls.Add(form);
                NavTabControl1.SelectedTab = tabItem;
            }
        }
コード例 #9
0
        void CreateTab(SuperTabControl tabControlName, string strTextSuperTabItem, string strNameSuperTabItem, string strNameSuperTabControlPanel, Office2007RibbonForm Form)
        {
            int intCheck = CheckExist(tabControlName, strNameSuperTabItem);

            if (intCheck > -1)
            {
                tabControlName.SelectedTabIndex = intCheck;
                Variable.stiSelected            = tabControlName.SelectedTab;
            }
            else
            {
                SuperTabItem sti = new SuperTabItem();
                sti.Name = strNameSuperTabItem;
                sti.Text = strTextSuperTabItem;
                SuperTabControlPanel stcp = new SuperTabControlPanel();
                stcp.Name = strNameSuperTabControlPanel;
                stcp.Dock = DockStyle.Fill;
                tabControlName.Controls.Add(stcp);
                sti.AttachedControl          = stcp;
                tabControlName.SelectedPanel = stcp;
                tabControlName.Tabs.Add(sti);
                Form.TopLevel = false;
                Form.Parent   = stcp;
                Form.Show();
                Form.Dock = DockStyle.Fill;
                tabControlName.SelectedTab = sti;
                Variable.stiSelected       = sti;
            }
        }
コード例 #10
0
ファイル: FormMain.cs プロジェクト: 0000duck/MES-3
 private void CloseAllTabs()
 {
     for (int i = superTabControlMain.Tabs.Count - 1; i >= 0; i--)
     {
         SuperTabItem tabitem = superTabControlMain.Tabs[i] as SuperTabItem;
         tabitem?.Close();
     }
 }
コード例 #11
0
        /// <summary>
        /// 双击关闭当前Tab页
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void superTabItem1_DoubleClick(object sender, EventArgs e)
        {
            SuperTabItem tabItem = (SuperTabItem)sender;

            if (tabItem != null && tabItem.CloseButtonVisible)
            {
                tabItem.Close();
            }
        }
コード例 #12
0
ファイル: TransactionForm.cs プロジェクト: AlixMeng/LiMS-2
        private void lendingTab_SelectedTabChanged(object sender, SuperTabStripSelectedTabChangedEventArgs e)
        {
            SuperTabItem tabItem = (SuperTabItem)e.NewValue;

            if (tabItem.AttachedControl != null)
            {
                tabItem.AttachedControl.Controls[0].Select();
            }
        }
コード例 #13
0
ファイル: FormMain.cs プロジェクト: 0000duck/MES-3
 private void CloseAllTabs()
 {
     for (int i = superTabControlMain.Tabs.Count - 1; i >= 0; i--)
     {
         SuperTabItem tabitem = superTabControlMain.Tabs[i] as SuperTabItem;
         tabitem?.Close();
     }
     SetMdiForm("默认页", typeof(FormDefault));
 }
コード例 #14
0
        /// <summary>
        /// 切换到指定选项卡
        /// </summary>
        /// <param name="uniqueKey">唯一标识符,用于区别于其他选项卡</param>
        public void ChangeToTab(string uniqueKey)
        {
            SuperTabItem superTabItem = GetTab(uniqueKey);

            if (superTabItem != null)
            {
                this.superTabControl.SelectedTab = superTabItem;
            }
        }
コード例 #15
0
 private void OnTabClose(SuperTabItem tab)
 {
     #region 关闭便签调用事件
     foreach (Form frm in tab.AttachedControl.Controls)
     {
         frm.Close();
         break;
     }
     #endregion
 }
コード例 #16
0
        private void CreateNewTab(SuperTabItem tab)
        {
            IDesignerHost dh = (IDesignerHost)GetService(typeof(IDesignerHost));
            SuperTabControl tabControl = Context.Instance as SuperTabControl;

            if (dh == null || tabControl == null)
                return;

            DesignerTransaction dt = dh.CreateTransaction();

            try
            {
                IComponentChangeService change =
                    GetService(typeof(IComponentChangeService)) as IComponentChangeService;

                if (change != null)
                    change.OnComponentChanging(Context.Container, null);

                SuperTabControlPanel panel = dh.CreateComponent(typeof(SuperTabControlPanel)) as SuperTabControlPanel;

                if (tab != null && panel != null)
                {
                    tab.AttachedControl = panel;
                    panel.TabItem = tab;

                    tabControl.Controls.Add(panel);
                    tabControl.Tabs.Add(tab);

                    panel.Dock = DockStyle.Fill;
                    panel.BringToFront();

                    tabControl.ApplyPanelStyle(panel);

                    tabControl.SelectedTab = tab;
                }

                if (change != null)
                    change.OnComponentChanged(Context.Container, null, null, null);

                if (change != null)
                {
                    change.OnComponentChanging(panel, null);
                    change.OnComponentChanged(panel, null, null, null);
                }
            }
            catch
            {
                dt.Cancel();
            }
            finally
            {
                if (!dt.Canceled)
                    dt.Commit();
            }
        }
コード例 #17
0
 public void CloseAllDocuments()
 {
     for (int i = tabControlMain.Tabs.Count - 1; i >= 0; i--)
     {
         SuperTabItem tabitem = tabControlMain.Tabs[i] as SuperTabItem;
         if (tabitem != null)
         {
             tabitem.Close();
         }
     }
 }
コード例 #18
0
ファイル: MainForm.cs プロジェクト: ericgohn/pst
        private void cmdModule_Executed(object sender, EventArgs e)
        {
            var button = sender as ButtonItem;

            if (button == null)
            {
                return;
            }
            var parameter = button.CommandParameter as string;

            if (parameter == null)
            {
                return;
            }
            var plugin = _pluginManager.GetPlugin(parameter);

            if (plugin == null)
            {
                return;
            }
            //遍历现有的Tab页面,如果存在,那么设置为选中即可
            foreach (SuperTabItem tabitem in stcMain.Tabs)
            {
                if (tabitem.Name == plugin.Key)
                {
                    stcMain.SelectedTab = tabitem;
                    return;
                }
            }

            var form = _pluginManager.FindOrCreatePluginMainForm(plugin);

            if (form == null)
            {
                return;
            }
            ((IPluginWindow)form).PluginContext.User = AppContext.S.User;
            ((IPluginWindow)form).BackgroundRunning += PluginForm_BackgroundRunning;
            ((IPluginWindow)form).Argument           = ribbonControl1;
//            form.WindowState = FormWindowState.Maximized;
            SuperTabItem tabItem = stcMain.CreateTab(form.Text);

            tabItem.Name = plugin.Key;
            tabItem.AttachedControl.Controls.Add(form);
            var mergable = form as IMergable;

            if (mergable != null)
            {
                mergable.Merge();
            }
            //设置Visible属性会导致OnLoad事件触发,故放在此处
            form.Visible        = true;
            stcMain.SelectedTab = tabItem;
        }
コード例 #19
0
 void SelectTab(SuperTabItem tab)
 {
     if (InvokeRequired)
     {
         this.Invoke(new InvokeTab(SelectTab), tab);
     }
     else
     {
         superTabControl2.SelectedTab = tab;
     }
 }
コード例 #20
0
 private void cefWebBrowerX_FrameLoadStart(object sender, CefSharp.FrameLoadStartEventArgs e)
 {
     if (e.Frame.IsMain)
     {
         SuperTabItem item = GetTabItem((CefWebBrowserX)sender);
         if (item == null)
         {
             return;
         }
     }
 }
コード例 #21
0
ファイル: FrmTestDetail.cs プロジェクト: vunb/CoreServicesNew
        //Xử lý sự kiện khi click vào lưới dữ liệu danh sách bệnh nhân
        private void GrdPatientsSelectionChanged(object sender, EventArgs e)
        {
            try
            {
                //superTabControl1.SuspendLayout();


                //superTabControl1.TabStrip.BeginUpdate();

                //Clear all tab
                ClearAllTabPage();

                //Lấy về PatientID
                if (grdPatients.CurrentRow != null)
                {
                    decimal patientId = Convert.ToDecimal(grdPatients.CurrentRow.Cells["Patient_ID"].Value);
                    //lấy về danh sách các loại xét nghiệm của bệnh nhân đó
                    string testtypeids = GetTestIdString();
                    _testTypeList = TestInfoBusiness.GetTestTypeIdFromDateToDate(patientId, testtypeids,
                                                                                 dtpFromDate.Value,
                                                                                 dtpTodate.Value);

                    AddNewUserTab("Tất cả", "-1");

                    foreach (DataRow dr in _testTypeList.Rows)
                    {
                        string testName =
                            dr[TTestTypeList.Columns.TestTypeName].ToString().ToUpper().Replace("XÉT NGHIỆM", "").Trim();
                        string testId = dr[TTestInfo.Columns.TestId].ToString();
                        AddNewUserTab(testName, testId);
                    }

                    //Lấy về TAB đầu tiên được chọn
                    SuperTabItem controls = (from control in superTabControl1.Tabs.OfType <SuperTabItem>()
                                             select control).First();

                    //Giả lập sự kiện Click trên Tab đầu tiên

                    if (controls != null)
                    {
                        controls.Focus();
                        TabClick(controls, new EventArgs());
                    }
                }
                //superTabControl1.ResetTabStripColor();
                //superTabControl1.TabStrip.EndUpdate();
                //superTabControl1.ResumeLayout();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                throw ex;
            }
        }
コード例 #22
0
ファイル: frmMain.cs プロジェクト: Alencc2015/Myc-
 public void CloseAllDocuments()
 {
     for (int i = NavTabControl.Tabs.Count - 1; i >= 1; i--)
     {
         SuperTabItem tabitem = NavTabControl.Tabs[i] as SuperTabItem;
         if (tabitem != null && tabitem.Text != "欢迎")
         {
             tabitem.Close();
         }
     }
 }
コード例 #23
0
 private void btn_ThayPhuTung_Click(object sender, EventArgs e)
 {
     if (KiemTraTenTabConTrol("&Thay phụ tùng") == false)
     {
         SuperTabItem  Tab = superTabControl1.CreateTab("&Thay phụ tùng");
         UcThayPhuTung frm = new UcThayPhuTung();
         frm.Dock = DockStyle.Fill;
         Tab.AttachedControl.Controls.Add(frm);
         frm.Show();
         superTabControl1.SelectedTabIndex = superTabControl1.Tabs.Count - 1;
     }
 }
コード例 #24
0
 private void btn_HoanThanh_Click(object sender, EventArgs e)
 {
     if (KiemTraTenTabConTrol("&Hoàn thành") == false)
     {
         SuperTabItem Tab = superTabControl1.CreateTab("&Hoàn thành");
         UcHoanThanh  frm = new UcHoanThanh();
         frm.Dock = DockStyle.Fill;
         Tab.AttachedControl.Controls.Add(frm);
         frm.Show();
         superTabControl1.SelectedTabIndex = superTabControl1.Tabs.Count - 1;
     }
 }
コード例 #25
0
ファイル: frmMain.cs プロジェクト: Alencc2015/Myc-
 private void NavTabControl_DoubleClick(object sender, EventArgs e)
 {
     if (ActiveMdiChild != null)
     {
         Type         formType = ActiveMdiChild.GetType();
         SuperTabItem tabitem  = NavTabControl.SelectedTab as SuperTabItem;
         if (tabitem != null && tabitem.Text != "欢迎" && formType != tabitem.AttachedControl.Controls[0].GetType())
         {
             tabitem.Close();
         }
     }
 }
コード例 #26
0
 private void btn_DieuChuyen_Click(object sender, EventArgs e)
 {
     if (KiemTraTenTabConTrol("&Điều chuyển") == false)
     {
         SuperTabItem Tab = superTabControl1.CreateTab("&Điều chuyển");
         UcDieuChuyen frm = new UcDieuChuyen();
         frm.Dock = DockStyle.Fill;
         Tab.AttachedControl.Controls.Add(frm);
         frm.Show();
         superTabControl1.SelectedTabIndex = superTabControl1.Tabs.Count - 1;
     }
 }
コード例 #27
0
ファイル: Form1.cs プロジェクト: annguyen0606/QuanLyNoiBo
 private void btn_RegistrationNew_Click(object sender, EventArgs e)
 {
     if (KiemTraTenTabConTrol("&Registration") == false)
     {
         SuperTabItem   Tab = superTabControl1.CreateTab("&Nhập xe");
         UCRegistration frm = new UCRegistration();
         frm.Dock = DockStyle.Fill;
         Tab.AttachedControl.Controls.Add(frm);
         frm.Show();
         superTabControl1.SelectedTabIndex = superTabControl1.Tabs.Count - 1;
     }
 }
コード例 #28
0
ファイル: FrmTestDetail.cs プロジェクト: vunb/CoreServicesNew
 private DataGridViewX GetGridinSelectedTab(SuperTabItem tab)
 {
     try
     {
         return((from control in tab.AttachedControl.Controls.OfType <DataGridViewX>()
                 select control).First());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #29
0
ファイル: frmMain.cs プロジェクト: Alencc2015/Myc-
 private void NavTabControl_TabStripMouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (ActiveMdiChild != null)
     {
         Type         formType = ActiveMdiChild.GetType();
         SuperTabItem tabitem  = NavTabControl.SelectedTab as SuperTabItem;
         if (tabitem != null && tabitem.Text != "欢迎")
         {
             tabitem.Close();
         }
     }
 }
コード例 #30
0
        private void FillSuperTabItem()
        {
            foreach (DataRow dr in dtTestTypeList.Rows)
            {
                var tab = new SuperTabItem();
                tab.Tag     = dr[TTestTypeList.Columns.TestTypeId].ToString();
                tab.Text    = ShortNameTestType(dr[TTestTypeList.Columns.TestTypeName].ToString());
                tab.Visible = true;

                sttResult.Tabs.Add(tab);
            }
        }
コード例 #31
0
 private void btn_ChonThoSua_Click(object sender, EventArgs e)
 {
     if (KiemTraTenTabConTrol("&Chọn thợ sửa") == false)
     {
         SuperTabItem Tab = superTabControl1.CreateTab("&Chọn thợ sửa");
         UcChonTho    frm = new UcChonTho();
         frm.Dock = DockStyle.Fill;
         Tab.AttachedControl.Controls.Add(frm);
         frm.Show();
         superTabControl1.SelectedTabIndex = superTabControl1.Tabs.Count - 1;
     }
 }
コード例 #32
0
        protected override void OnMouseDragBegin(int x, int y)
        {
            base.OnMouseDragBegin(x, y);

            if (DragInProgress == true)
                _SelectItem = _TabStrip.SelectedTab;
        }