示例#1
0
        private void ViewRoutePanel(Switchboard panel,
                                    Route route,
                                    XtraTabControl tabControl,
                                    XtraTabPage tabPage,
                                    SwitchboardRouteEditorControl.CellClickedEventHandler cellClickEvent,
                                    SwitchboardRouteEditorControl.BlockClickedEventHandler blockClickEvent)
        {
            XtraTabPage tabPanel;

            tabControl.SuspendLayout();

            // Generate the grid
            SwitchboardRouteEditorControl spcPanel = new SwitchboardRouteEditorControl(panel, route);

            spcPanel.Dock              = DockStyle.Fill;
            spcPanel.Location          = new System.Drawing.Point(5, 5);
            spcPanel.Name              = "grdPanel" + panel.ID;
            spcPanel.BorderStyle       = BorderStyle.FixedSingle;
            spcPanel.DesignModeEnabled = true;

            // Enable grid events
            if (cellClickEvent != null)
            {
                spcPanel.CellClick += cellClickEvent;
            }
            if (blockClickEvent != null)
            {
                spcPanel.ElementClick += blockClickEvent;
            }

            // Generate the tab page
            if (tabPage == null)
            {
                tabPanel = new XtraTabPage();

                // tabPanel.Controls.Add(grdPanel);
                tabPanel.Name    = "tabPanel" + panel.ID;
                tabPanel.Padding = new Padding(5);
                tabPanel.Text    = panel.Name;
                tabPanel.Image   = Switchboard.SmallIcon;
                tabPanel.Tag     = panel;
                tabPanel.Controls.Add(spcPanel);
            }
            else
            {
                // Clear all page contents
                tabPage.Controls.Clear();

                tabPanel = tabPage;
            }

            tabControl.TabPages.Add(tabPanel);

            // Select the new panel
            tabControl.SelectedTabPage = tabPanel;

            tabControl.ResumeLayout(false);
        }
        public void GenerateGuiControls()
        {
            //suspend tab layout
            ((System.ComponentModel.ISupportInitialize)(topLevelParent)).BeginInit();
            topLevelParent.SuspendLayout();


            //resume tab layout
            ((System.ComponentModel.ISupportInitialize)(topLevelParent)).EndInit();
            topLevelParent.ResumeLayout(false);
        }
        private void ViewAddCommandPanel(Switchboard panel,
                                         XtraTabControl tabControl,
                                         XtraTabPage tabPage,
                                         SwitchboardCommandControl.BlockAssignmentChangedEventHandler blockAssignmentChangedEvent)
        {
            XtraTabPage tabPanel;

            tabControl.SuspendLayout();

            // Generate the grid
            SwitchboardCommandControl spcPanel = new SwitchboardCommandControl(panel);

            spcPanel.Dock        = System.Windows.Forms.DockStyle.Fill;
            spcPanel.Location    = new System.Drawing.Point(5, 5);
            spcPanel.Name        = "grdPanel" + panel.ID;
            spcPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;

            // Subscribe required events
            spcPanel.BlockAssignmentChanged += blockAssignmentChangedEvent;

            // Generate the tab page
            if (tabPage == null)
            {
                tabPanel = new XtraTabPage();

                // tabPanel.Controls.Add(grdPanel);
                tabPanel.Name    = "tabPanel" + panel.ID;
                tabPanel.Padding = new System.Windows.Forms.Padding(5);
                tabPanel.Text    = panel.Name;
                tabPanel.Image   = Switchboard.SmallIcon;
                tabPanel.Tag     = panel;
                tabPanel.Controls.Add(spcPanel);
            }
            else
            {
                // Clear all page contents
                tabPage.Controls.Clear();

                tabPanel = tabPage;
            }

            tabControl.TabPages.Add(tabPanel);

            // Select the new panel
            tabControl.SelectedTabPage = tabPanel;

            tabControl.ResumeLayout(false);
        }
        public static void ViewAddPanel(Switchboard panel,
                                        XtraTabControl tabControl,
                                        XtraTabPage tabPage,
                                        SwitchboardDesignControl.CellClickedEventHandler cellClickEvent,
                                        SwitchboardDesignControl.BlockClickedEventHandler blockClickEvent,
                                        SwitchboardDesignControl.BlockDoubleClickedEventHandler blockDoubleClickEvent)
        {
            XtraTabPage tabPanel;

            tabControl.SuspendLayout();

            // Generate the grid
            SwitchboardDesignControl spcPanel = new SwitchboardDesignControl(panel);

            spcPanel.Dock        = DockStyle.Fill;
            spcPanel.Location    = new System.Drawing.Point(5, 5);
            spcPanel.Name        = "grdPanel" + panel.ID;
            spcPanel.BorderStyle = BorderStyle.FixedSingle;

            // Enable grid events
            if (cellClickEvent != null)
            {
                spcPanel.CellClick += cellClickEvent;
            }
            if (blockClickEvent != null)
            {
                spcPanel.ElementClick += blockClickEvent;
            }
            if (blockDoubleClickEvent != null)
            {
                spcPanel.BlockDoubleClick += blockDoubleClickEvent;
            }

            // Generate the tab page
            if (tabPage == null)
            {
                tabPanel = new XtraTabPage();

                // tabPanel.Controls.Add(grdPanel);
                tabPanel.Name    = "tabPanel" + panel.ID;
                tabPanel.Padding = new Padding(5);
                tabPanel.Text    = panel.Name;
                tabPanel.Image   = Properties.Resources.ICO_PANEL_16;
                tabPanel.Tag     = panel;
                tabPanel.Controls.Add(spcPanel);
            }
            else
            {
                // Clear all page contents
                tabPage.Controls.Clear();

                tabPanel = tabPage;
            }

            tabControl.TabPages.Add(tabPanel);

            // Select the new panel
            tabControl.SelectedTabPage = tabPanel;

            tabControl.ResumeLayout(false);
        }
示例#5
0
        public XtraTabPage AddNewTab(ref XtraTabControl tab_control, int width, int height, string text, int curTabIndex, RibbonControl ribbonControl)
        {
            XtraTabPage newTab = new XtraTabPage();
            //TreeList newTree = new TreeList();
            GridControl newGrid = new GridControl();

            GridView newGridView = new GridView();

            if (tab_control != null)
            {
                try
                {
                    tab_control.SuspendLayout();

                    tab_control.TabPages.Add(newTab);

                    newTab.Controls.Add(newGrid);
                    //newTab.Name = name;
                    newTab.Size = new System.Drawing.Size(width, height);
                    newTab.Text = text;

                    newGrid.Dock = DockStyle.Fill;
                    newGrid.Location = new System.Drawing.Point(0, 0);
                    newGrid.MainView = newGridView;
                    newGrid.MenuManager = ribbonControl;
                    newGrid.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { newGridView });
                    //newTree.Name = "tab_" + noOfTab;
                    newGrid.TabIndex = curTabIndex++;
                    noOfTab++;
                    newGrid.Click += new EventHandler(newTree_Click);
                    newGridView.GridControl = newGrid;
                    tab_control.ResumeLayout(false);

                }
                catch (Exception e1) { MessageBox.Show(e1.ToString()); }
                return newTab;
            }
            else
            {
                return null;
            }
        }