public PropertyGrid() { onComponentAdd = new ComponentEventHandler(OnComponentAdd); onComponentRemove = new ComponentEventHandler(OnComponentRemove); onComponentChanged = new ComponentChangedEventHandler(OnComponentChanged); SuspendLayout(); AutoScaleMode = AutoScaleMode.None; if (!isScalingInitialized) { if (DpiHelper.IsScalingRequired) { normalButtonSize = DpiHelper.LogicalToDeviceUnits(DEFAULT_NORMAL_BUTTON_SIZE); largeButtonSize = DpiHelper.LogicalToDeviceUnits(DEFAULT_LARGE_BUTTON_SIZE); } isScalingInitialized = true; } try { gridView = CreateGridView(null); gridView.TabStop = true; gridView.MouseMove += new MouseEventHandler(this.OnChildMouseMove); gridView.MouseDown += new MouseEventHandler(this.OnChildMouseDown); gridView.TabIndex = 2; separator1 = CreateSeparatorButton(); separator2 = CreateSeparatorButton(); toolStrip = new ToolStrip(); toolStrip.SuspendLayout(); toolStrip.ShowItemToolTips = true; toolStrip.AccessibleName = SR.GetString(SR.PropertyGridToolbarAccessibleName); toolStrip.AccessibleRole = AccessibleRole.ToolBar; toolStrip.TabStop = true; toolStrip.AllowMerge = false; // This caption is for testing. toolStrip.Text = "PropertyGridToolBar"; // LayoutInternal handles positioning, and for perf reasons, we manually size. toolStrip.Dock = DockStyle.None; toolStrip.AutoSize = false; toolStrip.TabIndex = 1; toolStrip.ImageScalingSize = normalButtonSize; // parity with the old... toolStrip.CanOverflow = false; // hide the grip but add in a few more pixels of padding. toolStrip.GripStyle = ToolStripGripStyle.Hidden; Padding toolStripPadding = toolStrip.Padding; toolStripPadding.Left = 2; toolStrip.Padding = toolStripPadding; SetToolStripRenderer(); // always add the property tab here AddRefTab(DefaultTabType, null, PropertyTabScope.Static, true); doccomment = new DocComment(this); doccomment.SuspendLayout(); doccomment.TabStop = false; doccomment.Dock = DockStyle.None; doccomment.BackColor = SystemColors.Control; doccomment.ForeColor = SystemColors.ControlText; doccomment.MouseMove += new MouseEventHandler(this.OnChildMouseMove); doccomment.MouseDown += new MouseEventHandler(this.OnChildMouseDown); hotcommands = new HotCommands(this); hotcommands.SuspendLayout(); hotcommands.TabIndex = 3; hotcommands.Dock = DockStyle.None; SetHotCommandColors(false); hotcommands.Visible = false; hotcommands.MouseMove += new MouseEventHandler(this.OnChildMouseMove); hotcommands.MouseDown += new MouseEventHandler(this.OnChildMouseDown); Controls.AddRange(new Control[] { doccomment, hotcommands, gridView, toolStrip }); SetActiveControlInternal(gridView); toolStrip.ResumeLayout(false); // SetupToolbar should perform the layout SetupToolbar(); this.PropertySort = PropertySort.Categorized | PropertySort.Alphabetical; this.Text = "PropertyGrid"; SetSelectState(0); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } finally { if (doccomment != null) { doccomment.ResumeLayout(false); } if (hotcommands != null) { hotcommands.ResumeLayout(false); } ResumeLayout(true); } }
/// <summary> /// Initializes new instance of DocCommentAccessibleObject. /// </summary> /// <param name="owningHotCommands">The owning HotCommands control.</param> /// <param name="parentPropertyGrid">The parent PropertyGrid control.</param> public HotCommandsAccessibleObject(HotCommands owningHotCommands, PropertyGrid parentPropertyGrid) : base(owningHotCommands) { _parentPropertyGrid = parentPropertyGrid; }
public PropertyGrid() { this.onComponentAdd = new ComponentEventHandler(this.OnComponentAdd); this.onComponentRemove = new ComponentEventHandler(this.OnComponentRemove); this.onComponentChanged = new ComponentChangedEventHandler(this.OnComponentChanged); base.SuspendLayout(); base.AutoScaleMode = AutoScaleMode.None; try { this.gridView = this.CreateGridView(null); this.gridView.TabStop = true; this.gridView.MouseMove += new MouseEventHandler(this.OnChildMouseMove); this.gridView.MouseDown += new MouseEventHandler(this.OnChildMouseDown); this.gridView.TabIndex = 2; this.separator1 = this.CreateSeparatorButton(); this.separator2 = this.CreateSeparatorButton(); this.toolStrip = new ToolStrip(); this.toolStrip.SuspendLayout(); this.toolStrip.ShowItemToolTips = true; this.toolStrip.AccessibleName = System.Windows.Forms.SR.GetString("PropertyGridToolbarAccessibleName"); this.toolStrip.AccessibleRole = AccessibleRole.ToolBar; this.toolStrip.TabStop = true; this.toolStrip.AllowMerge = false; this.toolStrip.Text = "PropertyGridToolBar"; this.toolStrip.Dock = DockStyle.None; this.toolStrip.AutoSize = false; this.toolStrip.TabIndex = 1; this.toolStrip.CanOverflow = false; this.toolStrip.GripStyle = ToolStripGripStyle.Hidden; System.Windows.Forms.Padding padding = this.toolStrip.Padding; padding.Left = 2; this.toolStrip.Padding = padding; this.SetToolStripRenderer(); this.AddRefTab(this.DefaultTabType, null, PropertyTabScope.Static, true); this.doccomment = new DocComment(this); this.doccomment.SuspendLayout(); this.doccomment.TabStop = false; this.doccomment.Dock = DockStyle.None; this.doccomment.BackColor = SystemColors.Control; this.doccomment.ForeColor = SystemColors.ControlText; this.doccomment.MouseMove += new MouseEventHandler(this.OnChildMouseMove); this.doccomment.MouseDown += new MouseEventHandler(this.OnChildMouseDown); this.hotcommands = new HotCommands(this); this.hotcommands.SuspendLayout(); this.hotcommands.TabIndex = 3; this.hotcommands.Dock = DockStyle.None; this.SetHotCommandColors(false); this.hotcommands.Visible = false; this.hotcommands.MouseMove += new MouseEventHandler(this.OnChildMouseMove); this.hotcommands.MouseDown += new MouseEventHandler(this.OnChildMouseDown); this.Controls.AddRange(new Control[] { this.doccomment, this.hotcommands, this.gridView, this.toolStrip }); base.SetActiveControlInternal(this.gridView); this.toolStrip.ResumeLayout(false); this.SetupToolbar(); this.PropertySort = System.Windows.Forms.PropertySort.CategorizedAlphabetical; this.Text = "PropertyGrid"; this.SetSelectState(0); } catch (Exception) { } finally { if (this.doccomment != null) { this.doccomment.ResumeLayout(false); } if (this.hotcommands != null) { this.hotcommands.ResumeLayout(false); } base.ResumeLayout(true); } }