Ejemplo n.º 1
0
        public void DockTo(IDockPanel parent, DockPanelState state, int size)
        {
            if (parent != null && !parent.Visible)
            {
                return;     // no need to throw exception if it not visible
            }

            var ctrl = parent != null ? parent.Control : _parent;

            //首先先创建一个DockPanel,然后将控件加上去
            DevExpress.XtraBars.Docking.DockPanel panel = new DevExpress.XtraBars.Docking.DockPanel();
            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.Controls.Add(_control);

            if (parent != null)
            {
                DevExpress.XtraBars.Docking.DockPanel parentPanel = _dockingManager.Panels[parent.Name];
                if (parentPanel != null)
                {
                    parentPanel.Controls.Add(panel);
                }
            }
            else
            {
                _dockingManager.AddPanel(panel.Dock, panel);
            }
        }
Ejemplo n.º 2
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);
            //}
        }
Ejemplo n.º 3
0
 public void DockTo(DockPanelState state, int size)
 {
     DockTo("", state, size);
 }