示例#1
0
        }          // implements IPopUp
        //
        #endregion //Properties


        #region Public Methods
        // *****************************************************************
        // ****                     Public Methods                      ****
        // *****************************************************************
        //
        //
        // ****             ShowMe              ****
        //
        /// <summary>
        /// Show the control.  Implements IPopUp.
        /// Called by the GUI thread.
        /// </summary>
        /// <param name="spawnControl">Control onto which popup is painted.</param>
        public void ShowMe(Control spawnControl)
        {
            // Tell control we are showing it.
            if (m_IEngineControl.GetType() == typeof(Graphs.ZGraphControl))
            {
                Graphs.ZGraphControl zGraphControl = (Graphs.ZGraphControl)m_IEngineControl;
                Clusters.Header      header        = this.ParentHeader; // grab Cluster header.
                Form displayForm = header.ParentForm;                   // grab the form that cluster is in.
                Clusters.ClusterDisplay display = (Clusters.ClusterDisplay)displayForm;
                if (display.GraphDisplay != null)                       // user has spawned a GraphDisplay.
                {
                    this.MdiParent = display.GraphDisplay;              // embed this into GraphDisplay.
                }
                zGraphControl.ShowMe(this);
            }


            // Disable the "exit" button.
            this.m_MenuManager = new SystemMenuManager(this, true, SystemMenuManager.MenuItemState.Disabled);

            Control parentForm = spawnControl.TopLevelControl;

            this.SuspendLayout();
            this.Visible = false;

            //
            // Find a good position for the popup.
            //
            Rectangle parentRect = parentForm.RectangleToScreen(parentForm.ClientRectangle);
            int       x          = parentRect.Left;         // parent inside edge coordinate.
            int       y          = parentRect.Top;          // parent inside edge coordinate.

            Rectangle spawnRect = parentForm.RectangleToClient(spawnControl.ClientRectangle);
            int       posX      = spawnControl.Location.X + x; // Starting guess position...
            int       posY      = spawnControl.Location.Y + y; //

            // Make sure that the popup remains inside the parent form.
            if (posX + this.Width > parentRect.Right)
            {
                posX = parentRect.Right - this.Width;
            }
            if (posY + this.Height > parentRect.Bottom)
            {
                posY = parentRect.Bottom - this.Height;
            }
            // now set locateion
            posX          = Math.Max(0, posX);              // keep it from going off the screen to the left.
            posY          = Math.Max(0, posY);
            this.Location = new Point(MarginSpace + posX, MarginSpace + posY);

            m_IEngineControl.Regenerate(this, null);        // updates values displayed, if needed

            this.Visible = true;
            this.ResumeLayout();
        }// ShowMe()
示例#2
0
        //
        #endregion//Properties


        #region Public Methods
        // *****************************************************************
        // ****                     Public Methods                      ****
        // *****************************************************************
        //
        //
        // ****             ShowMe              ****
        //
        /// <summary>
        /// Show the control.  Implements IPopUp.
        /// </summary>
        /// <param name="spawnControl">Control onto which popup is painted.</param>
        public void ShowMe(Control spawnControl)
        {
            // Tell control we are showing it. TODO: Put this in IEngineControl interface!
            if (m_CustomControl.GetType() == typeof(Graphs.ZGraphControl))
            {
                ((Graphs.ZGraphControl)m_CustomControl).ShowMe(this);
            }

            this.m_MenuManager = new SystemMenuManager(this, true, SystemMenuManager.MenuItemState.Greyed);

            Control parentForm = spawnControl.TopLevelControl;

            this.SuspendLayout();
            this.Visible = false;

            //
            // Find a good position for the popup.
            //
            Rectangle parentRect = parentForm.RectangleToScreen(parentForm.ClientRectangle);
            int       x          = parentRect.Left; // parent inside edge coordinate.
            int       y          = parentRect.Top;  // parent inside edge coordinate.
            //int posX = spawningControl.Left + x;     // Starting guess position...
            //int posY = spawningControl.Top + y;      //

            Rectangle spawnRect = parentForm.RectangleToClient(spawnControl.ClientRectangle);
            int       posX      = spawnControl.Location.X + x; // Starting guess position...
            int       posY      = spawnControl.Location.Y + y; //

            // Make sure that the popup remains inside the parent form.
            if (posX + this.Width > parentRect.Right)
            {
                posX = parentRect.Right - this.Width;
            }
            if (posY + this.Height > parentRect.Bottom)
            {
                posY = parentRect.Bottom - this.Height;
            }
            // now set locateion
            posX          = Math.Max(0, posX); // keep it from going off the screen to the left.
            posY          = Math.Max(0, posY);
            this.Location = new Point(MarginSpace + posX, MarginSpace + posY);

            m_CustomControl.Regenerate(this, null);   // updates values displayed, if needed

            this.Visible = true;
            this.ResumeLayout();
        }// ShowMe()