コード例 #1
0
        // Function Add User Control to FormMain
        private void addUserControl(UserControl userControl)
        {
            if (!panelMain.Controls.Contains(userControl))
            {
                panelMain.Controls.Add(userControl);
                userControl.Dock = DockStyle.Fill;
                userControl.BringToFront();
            }
            else
            {
                userControl.BringToFront();
            }

            if (userControl == ValidateCard.Instance)
            {
                txtCardNo.Enabled = true;
            }
            else
            {
                txtCardNo.Enabled = false;
            }

            if (userControl == ValidatePin.Instance)
            {
                ValidatePin.Instance.clearTextBoxPin();
            }
        }
コード例 #2
0
        /// <summary>
        /// 添加标签 添加内容窗体
        /// </summary>
        /// <param name="userContol">新窗体</param>
        /// <param name="memuName">标签名</param>
        /// <param name="menuId">三级菜单id</param>
        /// <param name="thisUcTag">当前窗体Tag tag包括(三级|一级| 二级 菜单的id)</param>
        /// ///  <param name="PUCName">父窗体Name</param>
        public void addUserControls(UserControl userContol, string memuName, string menuId, string thisUcTag, string PUCName)
        {
            try
            {
                if (thisUcTag != null)
                {
                    string[] strArr = thisUcTag.Split('|');
                    if (!panel_Content.Controls.ContainsKey(menuId))
                    {
                        Image myImage = null;
                        if (GlobalStaticObj.gLoginDataSet != null &&
                            GlobalStaticObj.gLoginDataSet.Tables.Count > 2 &&
                            GlobalStaticObj.gLoginDataSet.Tables[2] != null &&
                            GlobalStaticObj.gLoginDataSet.Tables[2].Rows.Count > 0)
                        {
                            DataView dv = GlobalStaticObj.gLoginDataSet.Tables[2].DefaultView;
                            dv.RowFilter = "fun_id='" + strArr[0] + "'";
                            if (dv.Count > 0)
                            {
                                DataRowView drv = dv[0];
                                if (drv["fun_img"] != DBNull.Value && drv["fun_img"].ToString().Length > 0)
                                {
                                    myImage = ServiceStationClient.Skin.SkinAssistant.GetResourcesImage(drv["fun_img"]);
                                }
                            }
                        }

                        userContol.Name = menuId;
                        userContol.Dock = DockStyle.Fill;
                        userContol.Focus();
                        panel_Content.Controls.Add(userContol);// panel_Main.Controls.Add(ucHome);
                        userContol.BringToFront();
                        userContol.Tag = menuId + "|" + strArr[1] + "|" + strArr[2] + "|" + PUCName;

                        childmemu(myImage, memuName, menuId, strArr[2], strArr[1], PUCName);
                    }
                    else
                    {
                        this.panel_Content.Controls.Find(menuId, false)[0].BringToFront();
                        childMemuState(menuId);
                    }
                    SYSModel.clsSysConfig.STR_CURR_TWOMEMU = strArr[2];
                }
                else
                {
                    userContol.Dock = DockStyle.Fill;
                    userContol.Focus();
                    panel_Content.Controls.Add(userContol);// panel_Main.Controls.Add(ucHome);
                    userContol.BringToFront();
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(ex.Message);
            }
        }
コード例 #3
0
 //Add control to container
 public void AddControl_ToContainer(DevExpress.XtraBars.FluentDesignSystem.FluentDesignFormContainer container, UserControl uc)
 {
     if (!container.Controls.Contains(uc))
     {
         container.Controls.Add(uc);
         uc.Dock = DockStyle.Fill;
         uc.BringToFront();
     }
     uc.BringToFront();
 }
コード例 #4
0
 public void showControl(UserControl control) {
     if (!pnlPrincipal.Contains(control))
     {
         pnlPrincipal.Controls.Add(control);
         control.Dock = DockStyle.Fill;
         control.BringToFront();
     }
     else
     {
         control.BringToFront();
     }
 }
コード例 #5
0
        private void loadUserContorl(object sender, EventArgs e)
        {
            string userCntrol = "";

            if (sender is PictureBox)
            {
                PictureBox tb = (PictureBox)sender;
                for (int i = 0; i < menuList.Length; i++)
                {
                    if (tb.Name == menuList[i][0])
                    {
                        userCntrol = menuList[i][2];
                        break;
                    }
                }
            }
            else if (sender is Label)
            {
                Label lable = (Label)sender;
                for (int i = 0; i < menuList.Length; i++)
                {
                    if (lable.Name == menuList[i][1])
                    {
                        userCntrol = menuList[i][2];
                        break;
                    }
                }
            }
            else if (sender is string)
            {
                userCntrol = (string)sender;
            }

            if (userCntrol == null)
            {
                Close();
            }
            else
            {
                userControlInstance = (UserControl)Activator.CreateInstance(Type.GetType(GetType().Namespace + "." + userCntrol), staffID);
                if (!mainPanel.Controls.Contains(userControlInstance))
                {
                    mainPanel.Controls.Add(userControlInstance);
                    userControlInstance.Dock = DockStyle.Fill;
                    userControlInstance.BringToFront();
                }
                else
                {
                    userControlInstance.BringToFront();
                }
            }
        }
コード例 #6
0
 private void BringUserControlToFront(UserControl userControl)
 {
     if (!panelMain.Controls.Contains(userControl))
     {
         panelMain.Controls.Add(userControl);
         userControl.Dock = DockStyle.Fill;
         userControl.BringToFront();
     }
     else
     {
         userControl.BringToFront();
     }
 }
コード例 #7
0
 public void CrearControl <T>(UserControl parameter, Button btn)
 {
     if (!panel1.Controls.Contains(parameter))
     {
         panel1.Controls.Add(parameter);
         parameter.Dock = DockStyle.Fill;
         parameter.BringToFront();
     }
     else
     {
         parameter.BringToFront();
     }
 }
コード例 #8
0
ファイル: Main.cs プロジェクト: Aakashbist/Aspire2
 // Bring User Control to front - Dilroop
 private void BringToFront(UserControl a)
 {
     if (!content_panel.Controls.Contains(a))
     {
         content_panel.Controls.Add(a);
         a.Dock = DockStyle.Fill;
         a.BringToFront();
     }
     else
     {
         a.BringToFront();
     }
 }
コード例 #9
0
ファイル: SwitchUserControl.cs プロジェクト: PierroD/CODEx
 public static void Switch(Panel pnl, UserControl uc)
 {
     if (!pnl.Controls.Contains(uc))
     {
         pnl.Controls.Add(uc);
         uc.Dock = DockStyle.Fill;
         uc.BringToFront();
     }
     else
     {
         uc.BringToFront();
     }
 }
コード例 #10
0
ファイル: UCManager.cs プロジェクト: dapuji/DrillManagement
        public void AddControlBehind(string cName)
        {
            UserControl baseControl = null;

            if (!TryGetExistsByName(cName, ref baseControl))
            {
                baseControl = CreateControlByName(cName);
            }
            if (currentControl != null)
            {
                currentControl.BringToFront();
            }
        }
コード例 #11
0
 public void MostrarControl(UserControl control)
 {
     if (!PnelEjecucion.Controls.Contains(control))
     {
         PnelEjecucion.Controls.Add(control);
         control.Dock = DockStyle.Fill;
         control.BringToFront();
     }
     else
     {
         control.BringToFront();
     }
 }
コード例 #12
0
 private void AfficherPageChoisie(UserControl userPage)
 {
     Controls.Clear();
     Controls.Add(userPage);
     userPage.Dock = DockStyle.Fill;
     userPage.BringToFront();
 }
コード例 #13
0
 //usercontroler ekleme
 private void UserEkle(UserControl userControl)
 {
     panelUser.Controls.Clear();
     userControl.Dock = DockStyle.Fill;
     userControl.BringToFront();
     panelUser.Controls.Add(userControl);
 }
        public void AddSecondaryControl(Control control)
        {
            if (control == null)
            {
                return;
            }
            secondaryPanel.Controls.Add(control);
            secondaryPanel.TabStop = IsExpanded;
            control.TabIndex       = secondaryPanel.Controls.Count;
            control.Dock           = DockStyle.Top;
            control.BringToFront();
            ExpandedHeight  = _expandedHeight + control.Height;
            control.Resize += NestedSecondaryControl_Resize;

            // add vertical margin
            UserControl blankControl = new UserControl
            {
                Size      = new Size(0, 5),
                BackColor = Color.Transparent,
                TabIndex  = secondaryPanel.Controls.Count,
                TabStop   = false
            };

            secondaryPanel.Controls.Add(blankControl);
            blankControl.Dock = DockStyle.Top;
            blankControl.BringToFront();
            ExpandedHeight = _expandedHeight + blankControl.Height;
            ShowDivider();
        }
コード例 #15
0
        public static void ShowView(UserControl view)
        {
            List <UserControl> removes = new List <UserControl>();

            foreach (UserControl control in Manage().mainView.Controls)
            {
                if (!control.GetType().Equals(typeof(HomePageView)))
                {
                    removes.Add(control);
                }
            }
            foreach (UserControl control in removes)
            {
                Manage().mainView.Controls.Remove(control);
                control.Dispose();
            }


            if (view != null)
            {
                Manage().showView = view;
                view.Dock         = DockStyle.Fill;
                Manage().mainView.Controls.Add(view);
                view.BringToFront();
            }
        }
コード例 #16
0
        private void DisplayTab(UserControl userControl, TabPage tabPage)
        {
            try
            {
                tabPage.Invoke((MethodInvoker) delegate
                {
                    if (!tabPage.Controls.Contains(userControl))
                    {
                        tabPage.Controls.Add(userControl);
                        ResizeTabControl(userControl, tabPage);
                    }
                });
            }
            catch
            {
                if (!tabPage.Controls.Contains(userControl))
                {
                    tabPage.Controls.Add(userControl);
                    ResizeTabControl(userControl, tabPage);
                }
            }

            userControl.Enabled = true;
            userControl.Visible = true;
            userControl.BringToFront();
        }
コード例 #17
0
        /// <summary>
        /// 左侧菜单点击事件
        /// </summary>
        /// <param name="fun">功能记录</param>
        /// <param name="ucLeftMenu">左侧菜单对象</param>
        public void MainFormAddLabel(DataRow fun, UCLeftMenu ucLeftMenu)
        {
            if (!this.panel_Content.Controls.ContainsKey(fun["fun_id"].ToString()))
            {
                //添加窗体
                UserControl uc = CommonCtrl.TraverseForm(fun["fun_uri"].ToString());
                if (uc == null)
                {
                    MessageBoxEx.Show(fun["fun_name"].ToString() + " 不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                uc.Name = fun["fun_id"].ToString();
                uc.Dock = DockStyle.Fill;
                uc.Focus();
                uc.Tag = fun["fun_id"].ToString() + "|" + ucLeftMenu.Name + "|" + fun["parent_id"].ToString();//三级 |一级| 二级 菜单的id
                panel_Content.Controls.Add(uc);
                uc.BringToFront();

                //添加页签
                Image myImage = null;
                if (fun["fun_img"] != DBNull.Value && fun["fun_img"].ToString().Length > 0)
                {
                    myImage = ServiceStationClient.Skin.SkinAssistant.GetResourcesImage(fun["fun_img"]);
                }
                childmemu(myImage, fun["fun_name"].ToString(), fun["fun_id"].ToString(), fun["parent_id"].ToString(), ucLeftMenu.Name, "");
            }
            else
            {
                panel_Content.Controls[fun["fun_id"].ToString()].BringToFront();
                childMemuState(fun["fun_id"].ToString());
            }
            SYSModel.clsSysConfig.STR_CURR_TWOMEMU = fun["parent_id"].ToString();
        }
コード例 #18
0
        /// <summary>
        /// 常用功能 添加菜单
        /// </summary>
        /// <param name="dr">DataRow一行数据 包括(fun_id,fun_name,fun_img,fun_uri,parent_id, firstid)firstid为一级菜单ID</param>
        private void MenuAdd(DataRow dr)
        {
            string menuId = dr["fun_id"].ToString();
            string url    = dr["fun_uri"].ToString();

            if (!this.panel_Content.Controls.ContainsKey(menuId))
            {
                UserControl uc = CommonCtrl.TraverseForm(url);
                if (uc == null)
                {
                    MessageBoxEx.Show(menuId + " 不存在!", "提示",
                                      MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                uc.Name = menuId;
                uc.Dock = DockStyle.Fill;
                uc.Focus();
                uc.Tag = menuId + "|" + dr["firstid"].ToString() + "|" + dr["parent_id"].ToString();//三级 |一级| 二级 菜单的id
                panel_Content.Controls.Add(uc);
                uc.BringToFront();
                Image myImage = null;
                if (dr["fun_img"] != DBNull.Value && dr["fun_img"].ToString().Trim().Length > 0)
                {
                    myImage = ServiceStationClient.Skin.SkinAssistant.GetResourcesImage(dr["fun_img"]);
                }
                childmemu(myImage, dr["fun_name"].ToString(),
                          dr["fun_id"].ToString(), dr["parent_id"].ToString(), dr["firstid"].ToString(), "");
            }
            else
            {
                this.panel_Content.Controls[menuId].BringToFront();
                childMemuState(menuId);
            }
        }
コード例 #19
0
ファイル: Main.cs プロジェクト: ycaihua/CurveLock
 private void AddPanel(UserControl pnl)
 {
     content.Controls.Add(pnl);
     ((ICompletePanel)pnl).Complete += PanelComplete;
     pnl.BringToFront();
     _menu.Enabled = false;
 }
コード例 #20
0
ファイル: Form1.cs プロジェクト: tuancter1999/QLNhanSu
 private void addControls(UserControl uc)
 {
     panel2.Controls.Clear();
     uc.Dock = DockStyle.Fill;
     panel2.Controls.Add(uc);
     uc.BringToFront();
 }
コード例 #21
0
 /// <summary>
 /// 左侧菜单点击事件
 /// </summary>
 /// <param name="fun">功能记录</param>
 /// <param name="ucLeftMenu">左侧菜单对象</param>
 public void MainFormAddLabel(DataRow fun, UCLeftMenu ucLeftMenu)
 {
     if (panel_Content.Controls.Find(fun["fun_id"].ToString(), true).Length == 0)
     {
         UserControl uc = CommonCtrl.TraverseForm(fun["fun_uri"].ToString());
         if (uc == null)
         {
             MessageBoxEx.Show(fun["fun_name"].ToString() + " 不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         uc.Name = fun["fun_id"].ToString();
         uc.Dock = DockStyle.Fill;
         uc.Focus();
         uc.Tag = fun["fun_id"].ToString() + "|" + ucLeftMenu.Name + "|" + fun["parent_id"].ToString();//三级 |一级| 二级 菜单的id
         panel_Content.Controls.Add(uc);
         uc.BringToFront();
         Image myImage = null;
         if (fun["fun_img"] != DBNull.Value && fun["fun_img"].ToString() != "")
         {
             myImage = (Image)ServiceStationClient.Skin.Properties.Resources.ResourceManager.GetObject(fun["fun_img"].ToString());
         }
         childmemu(myImage, fun["fun_name"].ToString(), fun["fun_id"].ToString(), fun["parent_id"].ToString(), ucLeftMenu.Name, "");
     }
     else
     {
         panel_Content.Controls.Find(fun["fun_id"].ToString(), true)[0].BringToFront();
         childMemuState(fun["fun_id"].ToString());
     }
     SYSModel.clsSysConfig.STR_CURR_TWOMEMU = fun["parent_id"].ToString();
 }
コード例 #22
0
 private void addUserControl(UserControl uc)
 {
     user_controlP.Controls.Clear();
     uc.Dock = DockStyle.Fill;
     uc.BringToFront();
     user_controlP.Controls.Add(uc);
 }
コード例 #23
0
 private void addusercontrol(UserControl Newcontrol, Panel newpanel)
 {
     Newcontrol.Dock = DockStyle.Fill;
     Newcontrol.BringToFront();
     newpanel.Controls.Clear();
     newpanel.Controls.Add(Newcontrol);
 }
コード例 #24
0
        //=======================================Functions========================================//

        private void SetTab(object sender, UserControl selectedTab)
        {
            SelectedTabImg.Top    = ((Control)sender).Top;
            SelectedTabImg.Height = ((Control)sender).Height;

            selectedTab.BringToFront();
        }
コード例 #25
0
        public void AddTool(string TabName, UserControl UserForm, Boolean Replace = false)
        {
            if (Replace)
            {
                for (int i = 0; i < usercontrol.TabPages.Count; i++)
                {
                    if (usercontrol.TabPages[i].Text.Equals(TabName))
                    {
                        Invoke((MethodInvoker) delegate
                        {
                            usercontrol.TabPages.RemoveAt(i);
                        });
                    }
                }
            }

            TabPage tabPage = new TabPage(TabName);

            UserForm.BringToFront();
            UserForm.Dock = DockStyle.Fill;
            tabPage.Controls.Add(UserForm);

            this.Invoke((MethodInvoker) delegate
            {
                usercontrol.TabPages.Add(tabPage);
                usercontrol.SelectedIndex = usercontrol.TabPages.Count - 1;
            });
        }
コード例 #26
0
 private void addControl(UserControl uc)
 {
     home_User1.Controls.Clear();
     uc.Dock = DockStyle.Fill;
     home_User1.Controls.Add(uc);
     uc.BringToFront();
 }
コード例 #27
0
ファイル: Form1.cs プロジェクト: snow-hash/YoutubeMacDemo
 private void addUserControl(UserControl uc)
 {
     panelContainer.Controls.Clear();
     uc.Dock = DockStyle.Fill;
     uc.BringToFront();
     panelContainer.Controls.Add(uc);
 }
コード例 #28
0
        public void AddNewElemModal(UserControl pl, string name)
        {
            if (showed_modal)
            {
                CloseModalElem();
            }

            if (list_of_controls[list_of_controls.Count - 1].Width < pl.Width)
            {
                standartWidthUderModalControl = list_of_controls[list_of_controls.Count - 1].Width;
                list_of_grbox[list_of_grbox.Count - 1].Width       = pl.Width + 32;
                list_of_controls[list_of_controls.Count - 1].Width = pl.Width + 30;
                width_controls += -standartWidthUderModalControl + list_of_controls[list_of_controls.Count - 1].Width;

                change_width = panel1.Width + width_controls + 6 - this.Width;

                speed = (Math.Abs(change_height) > Math.Abs(change_width)) ? Math.Abs(change_height) / delta_speed : Math.Abs(change_width) / delta_speed;
                if (speed < 3)
                {
                    speed = 3;
                }
                timerr.Enabled = true;
                //this.Size = new Size(panel1.Width + width_controls, max_height_control + 45);
            }

            list_of_controls[list_of_controls.Count - 1].Enabled = false;
            list_of_grbox[list_of_grbox.Count - 1].Controls.Add(pl);
            pl.BringToFront();
            pl.Location   = new Point((list_of_grbox[list_of_grbox.Count - 1].Width - pl.Width) / 2, (list_of_grbox[list_of_grbox.Count - 1].Height - pl.Height) / 2);
            modal_comtrol = pl;
            showed_modal  = true;
        }
コード例 #29
0
ファイル: Home.cs プロジェクト: iremakalp/KelimeOyunu
 private void addUserControl(UserControl uc)
 {
     ucHomePanel.Controls.Clear();
     uc.Dock = DockStyle.Fill;
     uc.BringToFront();
     ucHomePanel.Controls.Add(uc);
 }
        public void AddPrimaryControl(Control control)
        {
            if (control == null)
            {
                return;
            }
            primaryPanel.Controls.Add(control);
            primaryPanel.TabStop = true;
            control.TabIndex     = primaryPanel.Controls.Count;
            control.Dock         = DockStyle.Top;
            control.BringToFront();
            control.Resize += PropertyEditorResized;
            UpdateHeights(control, true);

            // add vertical margin
            UserControl blankControl = new UserControl
            {
                Size      = new Size(0, 5),
                BackColor = Color.Transparent,
                TabIndex  = primaryPanel.Controls.Count,
                TabStop   = false
            };

            primaryPanel.Controls.Add(blankControl);
            blankControl.Dock = DockStyle.Top;
            blankControl.BringToFront();
            UpdateHeights(blankControl, true);
        }