private DockingStyle ToDockingStyle(ViewDockingState viewDockingOption)
        {
            DockingStyle result = DockingStyle.Left;

            switch (viewDockingOption)
            {
            case ViewDockingState.Left:
                result = DockingStyle.Left;
                break;

            case ViewDockingState.Top:
                result = DockingStyle.Top;
                break;

            case ViewDockingState.Right:
                result = DockingStyle.Right;
                break;

            case ViewDockingState.Bottom:
                result = DockingStyle.Bottom;
                break;

            case ViewDockingState.Float:
                result = DockingStyle.Float;
                break;

            case ViewDockingState.Fill:
                result = DockingStyle.Fill;
                break;

            default:
                throw new ArgumentException("Invalid value of viewDockingOption.");
            }
            return(result);
        }
        internal static DockPanelState SyncfusionToMapWindow(DockingStyle style)
        {
            switch (style)
            {
            case DockingStyle.Top:
                return(DockPanelState.Top);

            case DockingStyle.Bottom:
                return(DockPanelState.Bottom);

            case DockingStyle.Left:
                return(DockPanelState.Left);

            case DockingStyle.Right:
                return(DockPanelState.Right);

            case DockingStyle.Tabbed:
                return(DockPanelState.Tabbed);

            case DockingStyle.Fill:
                return(DockPanelState.Fill);

            case DockingStyle.None:
            default:
                return(DockPanelState.None);
            }
        }
Exemple #3
0
 private void SetDockingStyle(DockingStyle value)
 {
     c1CommandDock1.DockingStyle = value;
     c1CommandDock2.DockingStyle = value;
     c1CommandDock3.DockingStyle = value;
     c1CommandDock4.DockingStyle = value;
 }
Exemple #4
0
 public void InitializeDock(Control view, DockingStyle dockingStyle, string title = null, int width = 200)
 {
     _dockingManager.SetDockLabel(view, title ?? view.Text ?? "Dr.Pipe");
     _dockingManager.SetEnableDocking(view, true);
     _dockingManager.SetDockAbility(view, DockAbility.All);
     _dockingManager.DockControl(view, _parent, dockingStyle, width);
     _dockingManager.SetDockVisibility(view, false);
 }
Exemple #5
0
        public void Add(DockablePanel panel)
        {
            Guard.ArgumentNotNull(panel, "panel");
            // we can't generate the Name (key) since we need it to persist with the dock panel layout.
            Guard.ArgumentNotNull(panel.Key, "Key");
            Guard.ArgumentNotNull(panel.InnerControl, "Panel");

            DockingStyle style = ConvertToDockingStyle(panel.Dock);
            DockPanel    dockPanel;

            if (panel.Dock == DockStyle.Fill)
            {
                // A dock panel cannot be created and docked to the form using the DockingStyle.Fill style,
                // that is a panel cannot occupy the form entirely. It can only be docked to the form's edge
                // or float.

                if (isFormLoaded)
                {
                    dockPanel = dockManager.AddPanel(DockingStyle.Float);
                }
                else
                {
                    loadingDeferredDockPanels.Add(panel);
                    return;
                }
            }
            else
            {
                dockPanel = CreatePanel(style);
            }

            dockPanel.Text   = panel.Caption;
            dockPanel.Width  = panel.InnerControl.Width;
            dockPanel.Height = panel.InnerControl.Height;
            dockPanel.Name   = panel.Key;
            dockPanel.ID     = StringToGuid(panel.Key); // allows us to serialize layout.
            UpdateSmallImage(panel, dockPanel);
            if (style == DockingStyle.Float)
            {
                dockPanel.FloatSize     = new System.Drawing.Size(panel.InnerControl.Width, panel.InnerControl.Height);
                dockPanel.FloatLocation = new System.Drawing.Point(Shell.Location.X + 200, Shell.Location.Y + 100);
                dockPanel.Visibility    = DockVisibility.Hidden;
            }
            dockPanel.Controls.Add(panel.InnerControl);
            panel.InnerControl.Dock = DockStyle.Fill;

            if (panel.Dock == DockStyle.Fill)
            {
                tabbedView.Controller.Dock(dockPanel);
            }
            panel.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(panel_PropertyChanged);
            OnPanelAdded(new DockablePanelEventArgs(panel.Key));
        }
Exemple #6
0
        protected override object XtraCreatePanelsItem(XtraItemEventArgs e)
        {
            DockingStyle dock   = DockLayoutUtils.ConvertToDockingStyle(e.Item.ChildProperties["Dock"].Value.ToString());
            TsDockPanel  result = new TsDockPanel(e.Item.ChildProperties["Count"].Value.ToString() == "0", dock, this, e.Item.ChildProperties["AlwaysTop"].Value.ToString() == "true");           //CreateDockPanel(dock, e.Item.ChildProperties["Count"].Value.ToString() == "0", e.Item.ChildProperties["AlwaysTop"]);

            if (IsDesignMode && Site != null && Site.Container != null)
            {
                Site.Container.Add(result);
            }

            return(result);
        }
Exemple #7
0
        public void Show(string name, string caption, DockingStyle dockingStyle, Func <UserControl> getUserControl)
        {
            switch (dockingStyle)
            {
            case DockingStyle.Left:
            case DockingStyle.Right:
            case DockingStyle.Top:
            case DockingStyle.Bottom:
                var dockPanel = _dockManager.Panels.FirstOrDefault(m => m.Name == name);
                if (dockPanel != null)
                {
                    dockPanel.Visibility = DockVisibility.Visible;
                }
                else
                {
                    var pnlContainer = _dockManager.Panels.FirstOrDefault(m => m.Dock == dockingStyle);
                    if (pnlContainer == null)
                    {
                        dockPanel = _dockManager.AddPanel(dockingStyle);
                    }
                    else
                    {
                        dockPanel = pnlContainer.AddPanel();
                        dockPanel.ParentPanel.Tabbed = true;
                    }
                    dockPanel.Text = caption;
                    dockPanel.Name = name;
                    var ctrl = getUserControl();
                    ctrl.Dock      = DockStyle.Fill;
                    dockPanel.Size = ctrl.Size;
                    dockPanel.ControlContainer.Controls.Add(ctrl);
                }
                _dockManager.ActivePanel = dockPanel;
                break;

            case DockingStyle.Fill:
                var document = _tabbedView.Documents.FindFirst(m => m.Control.Name == name);
                if (document == null)
                {
                    var ctrl = getUserControl();
                    ctrl.Name        = name;
                    ctrl.Dock        = DockStyle.Fill;
                    document         = _tabbedView.AddDocument(ctrl);
                    document.Caption = caption;
                }
                _tabbedView.Controller.Activate(document);
                break;

            default:
                throw new NotSupportedException();
            }
        }
Exemple #8
0
        private void ShowModule(string caption, DockingStyle dockingStyle, Func <UserControl> getUserControl)
        {
            var olHandle = SplashScreenManager.ShowOverlayForm(this);

            try
            {
                ShowManager.It.Show(caption, dockingStyle, getUserControl);
                olHandle.Close();
            }
            catch (Exception ex)
            {
                olHandle.Close();
                MsgHelper.ShowError("加载{0}出错!错误消息:{1}".FormatWith(caption, ex.Message));
            }
        }
Exemple #9
0
        private int GetImageIndex(DockingStyle ds)
        {
            switch (ds)
            {
            case DockingStyle.Top:
                return(this.imageList1.Images.IndexOfKey("down"));

            case DockingStyle.Right:
                return(this.imageList1.Images.IndexOfKey("left"));

            case DockingStyle.Bottom:
                return(this.imageList1.Images.IndexOfKey("up"));

            case DockingStyle.Left:
                return(this.imageList1.Images.IndexOfKey("right"));
            }

            // the default docking style is left - so right arrow is shown
            return(1);
        }
Exemple #10
0
        private DockPanel CreatePanel(DockingStyle style)
        {
            foreach (DockPanel panel in dockManager.Panels)
            {
                if (panel.Dock == style)
                {
                    // todo: allow plugin developer to specify other orientations:
                    // if we call dockManager.AddPanel(style), we would create a vertical split
                    // if we call panel.AddPanel, we create a horizontal split.

                    // create a new tab.
                    var newPanel = panel.AddPanel();
                    if (panel.ParentPanel != null)
                    {
                        panel.ParentPanel.Tabbed = true;
                    }

                    return(newPanel);
                }
            }

            return(dockManager.AddPanel(style));
        }
 public CustomDockLayout(DockingStyle dock, DockPanel panel) : base(dock, panel)
 {
 }
Exemple #12
0
 protected internal MyDockPanel(bool createControlContainer, DockingStyle dock, DockManager dockManager)
     : base(createControlContainer, dock, dockManager)
 {
     DockLayout = new MyDockLayout(dock, this);
 }
Exemple #13
0
 public void Show(string caption, DockingStyle dockingStyle, Func <UserControl> getUserControl)
 {
     Show(caption, caption, dockingStyle, getUserControl);
 }
Exemple #14
0
        public static void CreatePad(System.Windows.Forms.Form form, DockManager dockManager, List <IPadContent> pads, DockingStyle dockStyle)
        {
            if (pads == null || pads.Count == 0)
            {
                return;
            }
            if (pads.Count == 1)
            {
                IPadContent      pad                 = pads[0];
                XtraUserControl  uc                  = (XtraUserControl)pad;
                DockPanel        dockPanel           = new DevExpress.XtraBars.Docking.DockPanel();
                ControlContainer dockPanel_Container = new ControlContainer();
                dockManager.RootPanels.AddRange(new DevExpress.XtraBars.Docking.DockPanel[] { dockPanel });

                dockPanel.Controls.Add(dockPanel_Container);
                dockPanel.Dock = dockStyle;
                dockPanel.DockedAsTabbedDocument            = false;
                dockPanel.Options.AllowDockAsTabbedDocument = false;
                dockPanel.ID       = System.Guid.NewGuid();
                dockPanel.Location = new System.Drawing.Point(0, 0);
                string 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         = pad.Title;
                if (pad.ShowCloseButton)
                {
                    dockPanel.Options.ShowCloseButton = true;
                }
                else
                {
                    dockPanel.Options.ShowCloseButton = false;
                }

                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;

                form.Controls.Add(dockPanel);

                ContentCollection.Add(pads[0]);
            }
            else
            {
                string    strName        = DateTime.Now.Ticks.ToString();
                DockPanel panelContainer = new DevExpress.XtraBars.Docking.DockPanel();

                dockManager.RootPanels.AddRange(new DevExpress.XtraBars.Docking.DockPanel[] { panelContainer });
                panelContainer.Dock         = dockStyle;
                panelContainer.ID           = System.Guid.NewGuid();
                panelContainer.Location     = new System.Drawing.Point(0, 0);
                panelContainer.Name         = "panelContainer" + strName;
                panelContainer.OriginalSize = new System.Drawing.Size(200, 200);
                panelContainer.Size         = new System.Drawing.Size(200, 200);
                panelContainer.Text         = "panelContainer" + strName;
                bool             bHaveActive = false;
                List <DockPanel> list        = new List <DockPanel>();
                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          = DevExpress.XtraBars.Docking.DockingStyle.Fill;
                    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.Options.ShowMaximizeButton = true;
                    dockPanel.Height = pads[i].PHeight;

                    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;
                    dockPanel_Container.Height   = pads[i].PHeight;

                    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;
                    uc.Height   = pads[i].PHeight;

                    list.Add(dockPanel);

                    if (pads[i].IsActive)
                    {
                        panelContainer.FloatVertical = true;
                        panelContainer.ActiveChild   = dockPanel;
                        bHaveActive = true;
                    }
                    ContentCollection.Add(pads[i]);
                }
                panelContainer.Controls.AddRange(list.ToArray());

                if (bHaveActive)
                {
                    panelContainer.Tabbed = true;
                }
                form.Controls.Add(panelContainer);
            }
        }
 public CustomDockPanel(bool createControlContainer, DockingStyle dock, DockManager dockManager)
     : base(createControlContainer, dock, dockManager)
 {
     DockLayout = new CustomDockLayout(dock, this);
 }
Exemple #16
0
 /// <summary>
 /// Creates the panel.
 /// </summary>
 /// <param name="panel">The panel.</param>
 /// <param name="title">The title.</param>
 /// <param name="dockStyle">The dock style.</param>
 /// <param name="size">The size.</param>
 /// <param name="parent">The parent.</param>
 /// <param name="tab">if set to <c>true</c> [tab].</param>
 public void UpdatePanelDocking(UserControl panel, string title, DockingStyle dockStyle, int size, Control parent = null, bool tab = false)
 {
     dockingManager.SetEnableDocking(panel, true);
     dockingManager.SetDockLabel(panel, title);
     dockingManager.DockControl(panel, parent, dockStyle, size, tab);
 }
 protected override DockPanel CreateDockPanel(DockingStyle dock, bool createControlContainer)
 {
     return(new CustomDockPanel(createControlContainer, dock, this));
 }
Exemple #18
0
        // Methods
        public DockPanel Add(ref UIDockPanel newPanel, DockingStyle dockStyle)
        {
            if (dockStyle == DockingStyle.Fill)
            {
                dockStyle = DockingStyle.Right;
            }
            if (this._panelSet.Contains(newPanel))
            {
                int index = this._panelSet.IndexOf(newPanel);
                newPanel                     = this._panelSet[index];
                newPanel.Panel.Dock          = dockStyle;
                newPanel.Panel.FloatSize     = new Size(newPanel.Width, newPanel.Height);
                newPanel.Panel.FloatLocation = newPanel.Location;
                if (newPanel.Panel.Visibility == DockVisibility.AutoHide)
                {
                    newPanel.Panel.Close();
                }
                if (newPanel.Panel.Visibility != DockVisibility.Visible)
                {
                    newPanel.Panel.Visibility = DockVisibility.AutoHide;
                    newPanel.Panel.ShowSliding();
                }
                return(newPanel.Panel);
            }
            DockPanel panel = DFApplication.Application.Workbench.AddPanel(dockStyle);

            panel.DockedAsTabbedDocument            = false;
            panel.Options.AllowDockAsTabbedDocument = false;
            panel.Text = newPanel.PanelName;
            int width = 0;

            if (newPanel.Width < 30)
            {
                width = this._defaultWidth;
            }
            else
            {
                width = newPanel.Width;
            }
            int height = 0;

            if (newPanel.Height < 100)
            {
                height = this._defaultHeight;
            }
            else
            {
                height = newPanel.Height;
            }
            panel.FloatSize     = new Size(width, height);
            panel.FloatLocation = newPanel.Location;
            if (this._tabPanel == null)
            {
                this._tabPanel = panel;
            }
            panel.Visibility = DockVisibility.AutoHide;
            panel.ShowSliding();
            newPanel.Panel = panel;
            this._panelSet.Add(newPanel);
            return(panel);
        }
Exemple #19
0
 public MyDockLayout(DockingStyle dock, Size size, DockPanel panel)
     : base(dock, size, panel)
 {
 }
Exemple #20
0
 protected override DockPanel CreateDockPanel(DockingStyle dock, bool createControlContainer)
 {
     return(new TsDockPanel(createControlContainer, dock, this, _alwayTop));
 }
Exemple #21
0
        /// <summary>
        /// Render views for stacked, side by side or tabbed
        /// </summary>

        void CreateCommonLayoutAndRenderViews(ViewLayout layout)
        {
            DockPanel        pdp    = null;  // parent dock panel which is a vertical or horizontal split panel or a tab panel
            DockPanel        dp     = null;  // current docking panel that contains the view panel & is stored in the ResultsDisplayPanel
            DockPanel        lastDp = null;
            XtraPanel        viewPanel;      // panel that contains current view control and is contained in a docking panel or directly in the views panel if single view on page
            ResultsViewProps view;
            DockingStyle     dockingStyle = DockingStyle.Top;

            if (layout == ViewLayout.SideBySide)
            {
                dockingStyle           = DockingStyle.Top;
                ResultsPage.LastLayout = layout;
            }

            else if (layout == ViewLayout.Stacked)
            {
                dockingStyle           = DockingStyle.Left;
                ResultsPage.LastLayout = layout;
            }

            else if (layout == ViewLayout.Tabbed)
            {
                dockingStyle             = DockingStyle.Left;
                ResultsPage.TabbedLayout = true;                 // set flag indicating tabbed layout
            }

            ResultsPage             page  = ResultsPage;
            List <ResultsViewProps> views = page.Views;

            DockManager dm = DockManager;

            dm.Clear();

            DockPanel activePanel = null;

            for (int vi = 0; vi < views.Count; vi++)
            {
                view           = views[vi];
                viewPanel      = new XtraPanel();     // the panel that will contain the view control, goes into a DockPanel or directly into the viewsPanel if only one view
                viewPanel.Dock = DockStyle.Fill;      // it will fill its containing panel

                if (views.Count == 1)                 // if just one view then let it use the full panel (no DockPanel with view header)
                {
                    Controls.Add(viewPanel);
                }

                else                 // create a new DockPanel, add the viewPanel to it and
                {
                    if (vi == 0)     // first panel, add to DockManager
                    {
                        dp = dm.AddPanel(dockingStyle);
                    }

                    else if (vi == 1)                     // 2nd panel, add to first which creates splitter
                    {
                        dp = lastDp.AddPanel();
                    }

                    else                     // additional panels are just added to splitter
                    {
                        dp = dm.RootPanels[0].AddPanel();
                    }

                    lastDp = dp;

                    SetupDockPanel(dp, view, viewPanel);

                    if (page.ActiveViewIndex == vi)
                    {
                        activePanel = dp;
                    }
                }
            }                        // view loop

            if (activePanel != null) // set the active panel
            {
                dm.ActivePanel = activePanel;
            }

            if (dm.RootPanels.Count > 0)
            {
                dm.RootPanels[0].Size = Size;
            }

            if (layout == ViewLayout.SideBySide)
            {
                foreach (DockPanel dp0 in dm.Panels)
                {
                    if (dp0.Count == 0)
                    {
                        dp0.Height = Height;
                    }
                }
                //dp0.Width = (int)(Width / (double)views.Count + .5);
            }

            else if (layout == ViewLayout.Stacked)
            {
                foreach (DockPanel dp0 in dm.Panels)
                {
                    if (dp0.Count == 0)
                    {
                        dp0.Width = Width;
                    }
                }
                //dp0.Height = (int)(Height / (double)views.Count + .5);
            }

            else if (layout == ViewLayout.Tabbed && dm.RootPanels.Count > 0)
            {
                SetupTabbedPanel(dm.RootPanels[0]);                 // make it tabbed
            }
            return;
        }
Exemple #22
0
 public void AddDockPanel(DockingStyle side)
 {
     tsDockManager1.AddPanel(side);
 }
Exemple #23
0
 public TsDockPanel(bool createControlContainer, DockingStyle dock, DockManager dockManager, bool alwaysTop) : base(createControlContainer, dock, dockManager)
 {
     AlwaysTop = alwaysTop;
 }
Exemple #24
0
        /// <summary>
        /// Add a new dockable panel showing a control.
        /// </summary>
        /// <param name="name">Panel name.</param>
        /// <param name="text">Text shown in the panel caption.</param>
        /// <param name="control">Control to be shown in the panel.</param>
        /// <param name="icon">Icon (16x16) for the panel tab.</param>
        /// <param name="position">Docking position.</param>
        public DockPanel AddDockPanel(string name, string text, Control control, Image icon, DockingStyle dockStyle)
        {
            DockPanel panel;

            // Initializations
            control.Dock = DockStyle.Fill;

            if (StudioContext.MainView.DockManager == null)
            {
                return(null);
            }

            // Check if the panel is created
            foreach (DockPanel pnl in StudioContext.MainView.DockManager.Panels)
            {
                if (pnl.Name.Equals(name))
                {
                    return(pnl);
                }
            }

            StudioContext.MainView.DockManager.BeginUpdate();

            panel       = StudioContext.MainView.DockManager.AddPanel(dockStyle);
            panel.Name  = name;
            panel.Image = icon;
            panel.Text  = text;
            panel.ControlContainer.Controls.Add(control);

            StudioContext.MainView.DockManager.EndUpdate();

            return(panel);
        }
Exemple #25
0
 private DockPanel GetPanelByDockingStyle(DockManager manager, DockingStyle style)
 {
     for (int i = 0; i < manager.RootPanels.Count; i++)
     {
         DockPanel panel = manager.RootPanels[i];
         if (panel == null || panel.Dock == DockingStyle.Float)
             continue;
         if (panel.Dock == style)
             return panel;
     }
     return null;
 }
        public static DockPanel AddDockPanel(DockingStyle dockingStyle, DockManager dockManager)
        {
            DockPanel dockpanel = null;
            DockPanel firstPanel = null;
            try
            {
                for (Int32 i = 0; i < dockManager.RootPanels.Count; i++)
                {
                    if (dockManager.RootPanels[i].Dock == dockingStyle)
                    {
                        firstPanel = dockManager.RootPanels[i];
                        break;
                    }
                }
                if (firstPanel != null)
                {
                    if (firstPanel.Dock == DockingStyle.Left)
                    {
                        dockpanel = firstPanel.AddPanel();
                        dockpanel.Dock = DockingStyle.Fill;
                        firstPanel.Dock = DockingStyle.Fill;
                        dockpanel.DockTo(firstPanel);
                    }
                    else if (firstPanel.Dock != DockingStyle.Float)
                    {
                        dockpanel = firstPanel.AddPanel();
                        dockpanel.Dock = DockingStyle.Fill;
                        firstPanel.Dock = DockingStyle.Fill;
                        dockpanel.DockAsTab(firstPanel);
                    }
                }
                else
                {
                    dockpanel = dockManager.AddPanel(dockingStyle);
                    //设定默认大小
                    //if (dockingStyle == DockingStyle.Left)
                    //{ dockpanel.Width = 250; }
                    //else
                    //{ dockpanel.Width = 300; }

                    //dockpanel.FloatSize = new Size(300, 600);
                }
            }
            catch (Exception ex)
            {
            }
            return dockpanel;
        }