Пример #1
0
        /// <summary>
        /// 在焦点显示容器控件内显示分层数据设置UI界面,即uis对应的界面。
        /// </summary>
        void SetCheckWindowFocus()
        {
            //Globles.ShowingUI = true;
            if (CurFocusPanel == null)
            {
                return;
            }
            //Point p = CurFocusPanel.AutoScrollPosition;
            CurFocusPanel.SuspendLayout();
            CurFocusPanel.AutoScrollPosition = new Point(0, 0);
            //Point p = CurFocusPanel.AutoScrollPosition;
            while (CurFocusPanel.Controls.Count > 0)
            {
                if (null != CurFocusPanel.Controls[0])
                {
                    CollectManualCreateComponentMemory(CurFocusPanel.Controls[0]);
                }
            }
            CurFocusPanel.Controls.Clear();
            Panel pn = CreateUI();

            if (pn != null)
            {
                CurFocusPanel.Controls.Add(pn);
            }
            //else
            //    //RmlDebug.Wrong("Null UI?");
            //CurFocusPanel.AutoScrollPosition = new Point(-p.X, -p.Y);
            CurFocusPanel.ResumeLayout(true);
        }
Пример #2
0
        /// <summary>
        /// 重排制定控件内子控件位置,并上溯调整所有包含此控件的各级父控件内的控件位置。
        /// </summary>
        /// <param name="ctr">需要重排的最低级的控件</param>
        /// <param name="level">上溯深度</param>
        public void RearrangeAllControl(Control ctr, int level)
        {
            Control c;

            //SuspendLayout all related controls
            CurFocusPanel.SuspendLayout();
            c = ctr;
            for (int i = 0; i <= level; i++)
            {
                c.SuspendLayout();
                c = c.Parent;
            }
            if (c != CurFocusPanel)
            {
                throw new Exception("参数异常....");
            }
            //Relayout all the related controls
            c = ctr;
            for (int i = 0; i <= level - 1; i++)
            {
                c = c.Parent;
                RearrangeAControl(c);
                //c = c.Parent;
            }
            c = ctr;
            for (int i = 0; i <= level; i++)
            {
                c.ResumeLayout();
                c = c.Parent;
            }
            CurFocusPanel.ResumeLayout(false);

            //强制重绘。不调用此函数可能导致滚动条操作显示故障。
            CurFocusPanel.PerformLayout();
        }
Пример #3
0
        public virtual void GetFocus()
        {
            if (CurFocusPanel == null)
            {
                return;
            }
            CurFocusPanel.SuspendLayout();
            while (CurFocusPanel.Controls.Count > 0)
            {
                if (null != CurFocusPanel.Controls[0])
                {
                    CollectManualCreateComponentMemory(CurFocusPanel.Controls[0]);
                }
            }
            CurFocusPanel.Controls.Clear();
            CurFocusPanel.AutoScrollPosition = new Point(0, 0);
            CurFocusPanel.ResumeLayout();
            PropertyGrid pg = new PropertyGrid();

            pg.SelectedObject = this;
            pg.Dock           = DockStyle.Fill;
            CurFocusPanel.Controls.Add(pg);
        }