Example #1
0
        /// <summary>
        /// Creates the controls that constitute the property page. The default implementation
        /// creates a property grid. This should be safe to re-entrancy.
        /// </summary>
        protected virtual void CreatePageControls()
        {
            if (this.propertyGrid == null && this.Project != null)
            {
                IVSMDPropertyBrowser pb = this.Project.ServiceProvider.GetService(typeof(IVSMDPropertyBrowser)) as IVSMDPropertyBrowser;
                this.propertyGrid = pb.CreatePropertyGrid();

                // Set the property grid properties
                this.propertyGrid.GridSort = _PROPERTYGRIDSORT.PGSORT_ALPHABETICAL | _PROPERTYGRIDSORT.PGSORT_CATEGORIZED;
                this.propertyGrid.SetOption(_PROPERTYGRIDOPTION.PGOPT_TOOLBAR, false);

                // Set some of the control properties
                Control gridControl = Control.FromHandle(new IntPtr(this.propertyGrid.Handle));
                gridControl.Dock    = DockStyle.Fill;
                gridControl.Visible = true;

                this.Panel.Controls.Add(gridControl);
            }
        }
Example #2
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();
        }