Example #1
0
        public void DockTo(string parentName, DockPanelState state, int size)
        {
            DevExpress.XtraBars.Docking.DockPanel parentPanel;
            if (string.IsNullOrEmpty(parentName))
            {
                parentPanel = null;
            }
            else
            {
                parentPanel = _dockingManager.Panels[parentName];

                if (parentPanel != null && parentPanel.Visibility == DockVisibility.Hidden)
                {
                    parentPanel = null;
                }
            }
            DevExpress.XtraBars.Docking.DockingStyle style = DockHelper.MapWindowToDevExpress(((IDockPanelView)_control).DefaultDock);
            if (style == DockingStyle.Fill)
            {
                style = DockingStyle.Float;
            }

            DevExpress.XtraBars.Docking.DockPanel panel = null;
            if (parentPanel == null)
            {
                panel = _dockingManager.AddPanel(style);
            }
            else
            {
                panel = parentPanel.AddPanel();
            }
            panel.Name   = ((IDockPanelView)_control).DockName;
            panel.Header = ((IDockPanelView)_control).Caption;
            panel.Image  = ((IDockPanelView)_control).Image;
            //panel.Dock = DockHelper.MapWindowToDevExpress(((IDockPanelView)_control).DefaultDock);
            panel.FloatSize = ((IDockPanelView)_control).DefaultSize;
            _control.Dock   = DockStyle.Fill;
            panel.TabText   = ((IDockPanelView)_control).Caption;
            panel.Text      = ((IDockPanelView)_control).Caption;
            panel.Controls.Add(_control);


            //    if (parentPanel != null)
            //    {
            //        parentPanel.Controls.Add(panel);
            //    }

            //else
            //{
            //    _dockingManager.AddPanel(panel.Dock, panel);
            //}
        }
Example #2
0
        private DockPanel DockTo(string parentName, IDockPanelView view)
        {
            DevExpress.XtraBars.Docking.DockPanel parentPanel;
            if (string.IsNullOrEmpty(parentName))
            {
                parentPanel = null;
            }
            else
            {
                parentPanel = _dockingManager.Panels[parentName];

                if (parentPanel != null && parentPanel.Visibility == DockVisibility.Hidden)
                {
                    parentPanel = null;
                }
            }
            DevExpress.XtraBars.Docking.DockingStyle style = DockHelper.MapWindowToDevExpress(view.DefaultDock);
            if (style == DockingStyle.Fill)
            {
                style = DockingStyle.Float;
            }

            DevExpress.XtraBars.Docking.DockPanel panel = null;
            if (parentPanel == null)
            {
                panel = _dockingManager.AddPanel(style);
            }
            else
            {
                panel = parentPanel.AddPanel();
            }
            panel.Name   = view.DockName;
            panel.Header = view.Caption;
            panel.Image  = view.Image;
            //panel.Dock = DockHelper.MapWindowToDevExpress(((IDockPanelView)_control).DefaultDock);
            panel.FloatSize      = view.DefaultSize;
            ((Control)view).Dock = DockStyle.Fill;
            panel.TabText        = view.Caption;
            panel.Text           = view.Caption;
            panel.Controls.Add((Control)view);
            return(panel);
        }
Example #3
0
        public static void CreateAutoHidePad(System.Windows.Forms.Form form, DockManager dockManager, List <IPadContent> pads, System.Windows.Forms.DockStyle dockStyle, DevExpress.XtraBars.Docking.DockingStyle dockStyle1)
        {
            if (pads == null || pads.Count == 0)
            {
                return;
            }
            string            strName        = DateTime.Now.Ticks.ToString();
            AutoHideContainer panelContainer = new DevExpress.XtraBars.Docking.AutoHideContainer();

            dockManager.AutoHideContainers.AddRange(new DevExpress.XtraBars.Docking.AutoHideContainer[] { panelContainer });

            panelContainer.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(236)))), ((int)(((byte)(239)))));
            panelContainer.Dock      = dockStyle;
            panelContainer.Location  = new System.Drawing.Point(20, 147);
            panelContainer.Name      = "panelContainer" + strName;
            panelContainer.Size      = new System.Drawing.Size(864, 20);

            for (int i = 0; i < pads.Count; i++)
            {
                XtraUserControl uc = (XtraUserControl)pads[i];

                DockPanel        dockPanel           = new DevExpress.XtraBars.Docking.DockPanel();
                ControlContainer dockPanel_Container = new ControlContainer();

                dockPanel.Controls.Add(dockPanel_Container);
                dockPanel.DockedAsTabbedDocument            = false;
                dockPanel.Options.AllowDockAsTabbedDocument = false;
                dockPanel.Dock          = dockStyle1;
                dockPanel.SavedDock     = dockStyle1;
                dockPanel.FloatVertical = true;
                dockPanel.ID            = System.Guid.NewGuid();
                dockPanel.Location      = new System.Drawing.Point(0, 0);
                strName                = DateTime.Now.Ticks.ToString();
                dockPanel.Name         = "dockPanel" + strName;
                dockPanel.OriginalSize = new System.Drawing.Size(200, 200);
                dockPanel.Size         = new System.Drawing.Size(200, 200);
                dockPanel.Text         = pads[i].Title;
                if (pads[i].ShowCloseButton)
                {
                    dockPanel.Options.ShowCloseButton = true;
                }
                else
                {
                    dockPanel.Options.ShowCloseButton = false;
                }
                dockPanel.Visibility = DockVisibility.AutoHide;

                dockPanel.Options.ShowMaximizeButton = true;

                dockPanel_Container.Controls.Add(uc);
                dockPanel_Container.Location = new System.Drawing.Point(0, 0);
                dockPanel_Container.Name     = "dockPanel_Container" + strName;
                dockPanel_Container.Size     = new System.Drawing.Size(200, 200);
                dockPanel_Container.TabIndex = 0;

                uc.Dock     = System.Windows.Forms.DockStyle.Fill;
                uc.Location = new System.Drawing.Point(0, 0);
                uc.Name     = "uc" + strName;
                uc.Size     = new System.Drawing.Size(200, 200);
                uc.TabIndex = 0;

                panelContainer.Controls.Add(dockPanel);

                ContentCollection.Add(pads[i]);
            }
            form.Controls.Add(panelContainer);
        }