예제 #1
0
 internal void CopyPropToDockForm(DockForm form)
 {
     form.AllowDock       = this.allowDock;
     form.FormBorderStyle = this.FormBorderStyle;
     form.Icon            = this.Icon;
     form.Text            = this.Text;
 }
예제 #2
0
        /// <summary>
        /// Reads the complete hierarchy from a file.
        /// </summary>
        /// <param name="file">The source XML file.</param>
        public static void ReadXml(string file)
        {
            XmlTextReader reader = null;

            try
            {
                // Load the reader with the data file and ignore all white space nodes.
                reader = new XmlTextReader(file);
                reader.WhitespaceHandling = WhitespaceHandling.None;

                // Parse the file and display each of the nodes.
                while (reader.Read())
                {
                    if (!reader.IsStartElement())
                    {
                        continue;
                    }

                    switch (reader.Name)
                    {
                    case "form":
                        Console.WriteLine("form");

                        DockForm form = new DockForm();
                        form.Opacity = 0;
                        form.Show();
                        form.ReadXml(reader.ReadSubtree());

                        //if (!form.RootContainer.IsEmpty)
                        form.Opacity = 1;
                        //else
                        //	form.Close();
                        break;

                    case "manager":
                        Console.WriteLine("manager");

                        string hostType = reader.GetAttribute("parent");
                        if (hostType != null)
                        {
                            foreach (DockManager m in managerList)
                            {
                                if (m.Parent.GetType().FullName == hostType)
                                {
                                    m.ReadXml(reader.ReadSubtree());
                                }
                            }
                        }
                        break;
                    }
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
        }
예제 #3
0
        internal static void UnRegisterForm(DockForm form)
        {
            if (!formList.Contains(form))
            {
                return;
            }

            formList.Remove(form);
        }
예제 #4
0
        internal void CopyToDockForm(DockForm form)
        {
            form.Location = this.Location;
            form.Size     = this.Size;
            form.RootContainer.Controls.Add(controlContainer);
            form.RootContainer.DockType = this.DockType;

            CopyPropToDockForm(form);
        }
예제 #5
0
        private void LoadDockForm()
        {
            DockForm form = new DockForm();

            CopyToDockForm(form);
            if (showFormAtOnLoad)
            {
                form.Show();
            }
        }
예제 #6
0
        internal static void FormActivated(DockForm form)
        {
            // Update Z-Order.
            if (!formList.Contains(form))
            {
                return;
            }

            formList.Remove(form);
            formList.Insert(0, form);
        }
예제 #7
0
        internal static DockForm GetFormAtPoint(Point pt, int startIndex)
        {
            for (int i = startIndex; i < formList.Count; i++)
            {
                DockForm f = formList[i] as DockForm;

                if (f.Bounds.Contains(pt) & f.Visible)
                {
                    return(f);
                }
            }

            return(null);
        }
예제 #8
0
        internal static void RegisterForm(DockForm form)
        {
            if (formList.Contains(form))
            {
                return;
            }

            if (form == null)
            {
                throw new ArgumentNullException("The form must not be null.");
            }

            form.Disposed += new EventHandler(ObjectDisposed);
            formList.Add(form);
        }
        private void FloatWindow()
        {
            Rectangle rc = RectangleToScreen(this.ClientRectangle);
            DockForm form = new DockForm(dragObject);
            form.Show();
            form.Location = new Point(MousePosition.X, MousePosition.Y);

            if (!DockManager.FastMoveDraw)
                form.Opacity = 1;

            form.StartMoving(new Point(MousePosition.X + 10, MousePosition.Y + 10));

            dragObject = null;

            if ((panList.Count == 0) & (dockType == DockContainerType.Document) & (removeable) & (this.Parent is DockContainer))
                (this.Parent as DockContainer).Controls.Remove(this);
        }
예제 #10
0
        internal void SetFormSizeBounds(DockForm form)
        {
            Size minSize = Size.Empty;
            Size maxSize = Size.Empty;

            foreach (DockPanel p in panList)
            {
                if (!p.MinFormSize.IsEmpty)
                {
                    if (p.MinFormSize.Width > minSize.Width)
                        minSize.Width = p.MinFormSize.Width;
                    if (p.MinFormSize.Height > minSize.Height)
                        minSize.Height = p.MinFormSize.Height;
                }

                if (!p.MaxFormSize.IsEmpty)
                {
                    if (p.MaxFormSize.Width < maxSize.Width)
                        maxSize.Width = p.MaxFormSize.Width;
                    if (p.MaxFormSize.Height < maxSize.Height)
                        maxSize.Height = p.MaxFormSize.Height;
                }
            }

            try
            {
                Size paddingSize = new Size(this.Padding.Left + this.Padding.Right, this.Padding.Top + this.Padding.Bottom);

                if (minSize.IsEmpty)
                    form.MinimumSize = Size.Empty;
                else
                    form.MinimumSize = Size.Add(minSize, paddingSize);

                if (maxSize.IsEmpty)
                    form.MaximumSize = Size.Empty;
                else
                    form.MaximumSize = Size.Add(maxSize, paddingSize);
            }
            catch (Exception ex)
            {
                Console.WriteLine("DockContainer.SetFormSizeBounds : " + ex.Message);
            }
        }
예제 #11
0
 private void LoadDockForm()
 {
     DockForm form = new DockForm();
     CopyToDockForm(form);
     if (showFormAtOnLoad)
         form.Show();
 }
예제 #12
0
        internal void CopyToDockForm(DockForm form)
        {
            form.Location = this.Location;
            form.Size = this.Size;
            form.RootContainer.Controls.Add(controlContainer);
            form.RootContainer.DockType = this.DockType;

            CopyPropToDockForm(form);
        }
예제 #13
0
 internal void CopyPropToDockForm(DockForm form)
 {
     form.AllowDock = this.allowDock;
     form.FormBorderStyle = this.FormBorderStyle;
     form.Icon = this.Icon;
     form.Text = this.Text;
 }
예제 #14
0
 internal static int GetZIndex(DockForm form)
 {
     return(formList.IndexOf(form));
 }
예제 #15
0
 internal static int GetZIndex(DockForm form)
 {
     return formList.IndexOf(form);
 }
예제 #16
0
        internal static void FormActivated(DockForm form)
        {
            // Update Z-Order.
            if (!formList.Contains(form))
                return;

            formList.Remove(form);
            formList.Insert(0, form);
        }
예제 #17
0
        /// <summary>
        /// Reads the complete hierarchy from a file.
        /// </summary>
        /// <param name="file">The source XML file.</param>
        public static void ReadXml(string file)
        {
            XmlTextReader reader = null;

            try
            {
                // Load the reader with the data file and ignore all white space nodes.
                reader = new XmlTextReader(file);
                reader.WhitespaceHandling = WhitespaceHandling.None;

                // Parse the file and display each of the nodes.
                while (reader.Read())
                {
                    if (!reader.IsStartElement())
                        continue;

                    switch (reader.Name)
                    {
                        case "form":
                            Console.WriteLine("form");

                            DockForm form = new DockForm();
                            form.Opacity = 0;
                            form.Show();
                            form.ReadXml(reader.ReadSubtree());

                            //if (!form.RootContainer.IsEmpty)
                                form.Opacity = 1;
                            //else
                            //	form.Close();
                            break;

                        case "manager":
                            Console.WriteLine("manager");

                            string hostType = reader.GetAttribute("parent");
                            if (hostType != null)
                            {
                                foreach (DockManager m in managerList)
                                    if (m.Parent.GetType().FullName == hostType)
                                        m.ReadXml(reader.ReadSubtree());
                            }
                            break;
                    }
                }
            }
            finally
            {
                if (reader != null)
                    reader.Close();
            }
        }
예제 #18
0
        internal static void RegisterForm(DockForm form)
        {
            if (formList.Contains(form))
                return;

            if (form == null)
                throw new ArgumentNullException("The form must not be null.");

            form.Disposed += new EventHandler(ObjectDisposed);
            formList.Add(form);
        }
예제 #19
0
        internal static void UnRegisterForm(DockForm form)
        {
            if (!formList.Contains(form))
                return;

            formList.Remove(form);
        }