Пример #1
0
        public void ShowContent(bool closeowner)
        {
            int dc = 0;

            DockContent frm = this.FindParentDocument(this.title);

            if (frm == null)
            {
                BaseForm b = new BaseForm();
                b.Parentdockpanel = parentdockpanel;
                b.TopLevel        = false;
                b.Text            = this.title;
                b.SessionKey      = this.Name;
                SessionUtils.SetSession(this.Name, new Hashtable());
                if (tempowner != null)
                {
                    tempowner.ChildContent = b;
                }
                b.OwnerForm   = tempowner;
                this.baseform = b;

                if (this.baseform.OwnerForm == null)
                {
                    this.Show(this.baseform.dockPanel);
                    this.baseform.Show(this.baseform.Parentdockpanel);
                }
                else
                {
                    this.Show(this.baseform.dockPanel);
                    dc = ((BaseForm)this.baseform.OwnerForm).Pane.Contents.IndexOf(((BaseForm)this.baseform.OwnerForm).Pane.ActiveContent);
                    if ((dc == ((BaseForm)this.baseform.OwnerForm).Pane.Contents.Count - 1))
                    {
                        this.baseform.Show(this.baseform.Parentdockpanel);
                    }
                    else
                    {
                        this.baseform.Show(((BaseForm)this.baseform.OwnerForm).Pane, ((BaseForm)this.baseform.OwnerForm).Pane.Contents[dc + 1]);
                    }
                }
                this.BringToFront();
            }
            else
            {
                frm.Show();
                frm.BringToFront();
            }

            //如果画面跳转后自己画面要关闭的话,用下面两句话,关闭自画面
            if (closeowner)
            {
                IDockContent content = (IDockContent)baseform.Pane.Contents[dc];
                content.DockHandler.Close();
                baseform.Close();
                baseform.Dispose();
            }
        }
Пример #2
0
        public void ShowContentAtFirst(bool closeowner)
        {
            int dc = 0;

            DockContent frm = this.FindParentDocument(this.title);

            if (frm == null)
            {
                BaseForm b = new BaseForm();
                b.Parentdockpanel = parentdockpanel;
                b.TopLevel        = false;
                b.Text            = this.title;
                b.SessionKey      = this.Name;
                SessionUtils.SetSession(this.Name, new Hashtable());
                if (tempowner != null)
                {
                    tempowner.ChildContent = b;
                }
                b.OwnerForm   = tempowner;
                this.baseform = b;
                //display at the first
                this.Show(this.baseform.dockPanel);
                if (this.parentdockpanel.DocumentsCount == 0)
                {
                    this.baseform.Show(this.baseform.Parentdockpanel);
                }
                else
                {
                    this.baseform.Show(this.baseform.Parentdockpanel.Panes[1], this.baseform.Parentdockpanel.Panes[1].Contents[0]);
                }



                //                if (this.owner == null)
                //                {
                //                    this.Show(this.baseform.dockPanel);
                //                    this.baseform.Show(this.baseform.Parentdockpanel);
                //                }
                //                else
                //                {
                //                    this.Show(this.baseform.dockPanel);
                //                    dc = owner.Pane.Contents.IndexOf(owner.Pane.ActiveContent);
                //                    if ((dc == owner.Pane.Contents.Count - 1))
                //                    {
                //                        this.baseform.Show(this.baseform.Parentdockpanel);
                //                    }
                //                    else
                //                    {
                //                        this.baseform.Show(owner.Pane, owner.Pane.Contents[dc + 1]);
                //                    }
                //                }
                this.BringToFront();
            }
            else
            {
                frm.Show();
                frm.BringToFront();
            }

            //如果画面跳转后自己画面要关闭的话,用下面两句话,关闭自画面
            if (closeowner)
            {
                IDockContent content = (IDockContent)baseform.Pane.Contents[dc];
                content.DockHandler.Close();
            }
        }