internal static DockingStyle MapWindowToSyncfusion(DockPanelState state)
        {
            switch (state)
            {
            case DockPanelState.Left:
                return(DockingStyle.Left);

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

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

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

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

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

            default:
                return(DockingStyle.None);
            }
        }
Beispiel #2
0
        private void SerializeDockPanel(string path)
        {
            DockPanelState state      = DockPanel.GetDockPanelState();
            var            serializer = new XmlSerializer(typeof(DockPanelState));

            using (var stream = new FileStream(path, FileMode.Create, FileAccess.Write))
                serializer.Serialize(stream, state);
        }
 protected override BaseHandlerState CreateHandlerState(DockPanelState state)
 {
     if (state == DockPanelState.Docking && Owner.DockManager.DockMode == DockMode.VS2005)
     {
         return(new CustomDockingHandlerStateVS2005(this));
     }
     return(base.CreateHandlerState(state));
 }
Beispiel #4
0
        private void SetupDockSize()
        {
            DockPanelState State = MainDock.GetDockPanelState();

            State.Regions.Add(new DockRegionState(DarkDockArea.Document));
            State.Regions.Add(new DockRegionState(DarkDockArea.Left, new Size(492, 811)));
            State.Regions.Add(new DockRegionState(DarkDockArea.Right, new Size(200, 100)));
            State.Regions.Add(new DockRegionState(DarkDockArea.Bottom, new Size(1040, 270)));
        }
Beispiel #5
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;

            _dockingManager.DockControl(_control, ctrl, DockHelper.MapWindowToSyncfusion(state), size);
        }
Beispiel #6
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            // 序列化储存到外部,以保存布局
            // 需要给 Dock 控件设置 SerializationKey 属性
            DockPanelState state = this.DemoDockPanel.GetDockPanelState();

            // 使用字典维护 Dock 控件和序列化 Key 的关系,还原布局时,需要传入一个根据 Key, 返回对应 Dock 控件的委托;
            var dictionary = new Dictionary <string, DarkDockContent>();

            if (dictionary.Count > 0)
            {
                this.DemoDockPanel.RestoreDockPanelState(state, (key) => dictionary[key]);
            }
        }
Beispiel #7
0
        /// <summary>
        /// Gets the size and docking state for a new docking panel.
        /// </summary>
        public void GetLayoutSpecs(TableEditorLayout layout, out int size, out DockPanelState state)
        {
            size  = 0;
            state = DockPanelState.None;

            switch (layout)
            {
            case TableEditorLayout.Tabbed:
                state = DockPanelState.Tabbed;
                break;

            case TableEditorLayout.Horizontal:
                state = DockPanelState.Right;
                size  = DockingClientSize.Width / _panels.Count();
                break;

            case TableEditorLayout.Vertical:
                state = DockPanelState.Bottom;
                size  = DockingClientSize.Height / _panels.Count();
                break;
            }
        }
Beispiel #8
0
        private void SerializeDockPanel(string path)
        {
            DockPanelState state = this.DockPanel.GetDockPanelState();

            SerializerHelper.Serialize(state, path);
        }
Beispiel #9
0
        private void DeserializeDockPanel(string path)
        {
            DockPanelState state = SerializerHelper.Deserialize <DockPanelState>(path);

            this.DockPanel.RestoreDockPanelState(state, this.GetContentBySerializationKey);
        }
Beispiel #10
0
 public void DockTo(DockPanelState state, int size)
 {
     DockTo(null, state, size);
 }
Beispiel #11
0
        //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;
        //    }
        //}

        internal static DevExpress.XtraBars.Docking.DockingStyle MapWindowToDevExpress(DockPanelState state)
        {
            switch (state)
            {
            case DockPanelState.Left:
                return(DevExpress.XtraBars.Docking.DockingStyle.Left);

            case DockPanelState.Right:
                return(DevExpress.XtraBars.Docking.DockingStyle.Right);

            case DockPanelState.Top:
                return(DevExpress.XtraBars.Docking.DockingStyle.Top);

            case DockPanelState.Bottom:
                return(DevExpress.XtraBars.Docking.DockingStyle.Bottom);

            case DockPanelState.Tabbed:
                return(DevExpress.XtraBars.Docking.DockingStyle.Fill);

            case DockPanelState.None:
            case DockPanelState.Fill:
                return(DevExpress.XtraBars.Docking.DockingStyle.Fill);

            default:
                return(DevExpress.XtraBars.Docking.DockingStyle.Float);
            }
        }