SetParent() private method

private SetParent ( IntPtr hWnd, IntPtr hWndParent ) : IntPtr
hWnd System.IntPtr
hWndParent System.IntPtr
return System.IntPtr
Esempio n. 1
0
        public virtual void Activate(IntPtr parent, RECT[] pRect, int bModal)
        {
            if (this.panel == null)
            {
                if (pRect == null)
                {
                    throw new ArgumentNullException("pRect");
                }

                this.panel         = new Panel();
                this.panel.Size    = new Size(pRect[0].right - pRect[0].left, pRect[0].bottom - pRect[0].top);
                this.panel.Text    = SR.GetString(SR.Settings, CultureInfo.CurrentUICulture);
                this.panel.Visible = false;
                this.panel.Size    = new Size(550, 300);
                this.panel.CreateControl();
                NativeMethods.SetParent(this.panel.Handle, parent);
            }

            if (this.grid == null && this.project != null && this.project.Site != null)
            {
                IVSMDPropertyBrowser pb = this.project.Site.GetService(typeof(IVSMDPropertyBrowser)) as IVSMDPropertyBrowser;
                Assumes.Present(pb);
                this.grid = pb.CreatePropertyGrid();
            }

            if (this.grid != null)
            {
                this.active = true;


                Control cGrid = Control.FromHandle(new IntPtr(this.grid.Handle));

                cGrid.Parent   = Control.FromHandle(parent);//this.panel;
                cGrid.Size     = new Size(544, 294);
                cGrid.Location = new Point(3, 3);
                cGrid.Visible  = true;
                this.grid.SetOption(_PROPERTYGRIDOPTION.PGOPT_TOOLBAR, false);
                this.grid.GridSort = _PROPERTYGRIDSORT.PGSORT_CATEGORIZED | _PROPERTYGRIDSORT.PGSORT_ALPHABETICAL;
                NativeMethods.SetParent(new IntPtr(this.grid.Handle), this.panel.Handle);
                UpdateObjects();
            }
            RegisterProjectEvents();
        }
Esempio n. 2
0
        // =========================================================================================
        // IPropertyPage Members
        // =========================================================================================

        /// <summary>
        /// Called when the environment wants us to create our property page.
        /// </summary>
        /// <param name="hwndParent">The HWND of the parent window.</param>
        /// <param name="rects">The bounds of the area that we should fill.</param>
        /// <param name="modal">Indicates whether the dialog box is shown modally or not.</param>
        void IPropertyPage.Activate(IntPtr hwndParent, RECT[] rects, int modal)
        {
            // create the panel control
            this.PropertyPagePanel = this.CreatePropertyPagePanel();
            this.PropertyPagePanel.HookupEvents();

            // we need to create the control so the handle is valid
            this.PropertyPagePanel.CreateControl();

            //this.PropertyPagePanel.HelpRequested += new HelpEventHandler(this.PropertyPagePanel_HelpRequested);

            // set our parent
            NativeMethods.SetParent(this.PropertyPagePanel.Handle, hwndParent);

            // set our initial size
            this.ResizeContents(rects[0]);
            ThreadHelper.ThrowIfNotOnUIThread();

            this.PropertyPagePanel.BindProperties();
            this.active  = true;
            this.IsDirty = false;
        }
Esempio n. 3
0
 void IPropertyPage.Activate(IntPtr hWndParent, RECT[] pRect, int bModal)
 {
     NativeMethods.SetParent(this.Control.Handle, hWndParent);
 }