private void createValueEditor(Type type) { Type editorType = Plugin.InvokeEditorType(type); Debug.Check(editorType != null); ParInfo par = this._property as ParInfo; if (_property.Variable == null || _property.Variable.GetValueType() != type) { _property.Variable = new VariableDef(Plugin.DefaultValue(type)); } _valueEditor = (DesignerPropertyEditor)editorType.InvokeMember(string.Empty, System.Reflection.BindingFlags.CreateInstance, null, null, new object[0]); _valueEditor.Margin = new System.Windows.Forms.Padding(0); _valueEditor.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; _valueEditor.Width = this.dispTextBox.Width; _valueEditor.Location = this.dispTextBox.Location; _valueEditor.Location = new Point(_valueEditor.Location.X, _valueEditor.Location.Y - _valueEditor.Height - 6); _valueEditor.ValueWasChanged += new DesignerPropertyEditor.ValueChanged(editor_ValueWasChanged); if (par != null) { _valueEditor.SetPar(par, null); } else { _valueEditor.SetVariable(this._property.Variable, null); } _valueEditor.ValueWasAssigned(); this.Controls.Add(_valueEditor); _valueEditor.BringToFront(); }
private DesignerPropertyEditor createValueEditor(int rowIndex, Type type) { Debug.Check(rowIndex > -1 && type != null); RowControl rowControl = _rowControls[rowIndex]; Type editorType = Plugin.InvokeEditorType(type); Debug.Check(editorType != null); DesignerPropertyEditor editor = (DesignerPropertyEditor)editorType.InvokeMember(string.Empty, BindingFlags.CreateInstance, null, null, new object[0]); editor.Dock = System.Windows.Forms.DockStyle.Fill; editor.Margin = new System.Windows.Forms.Padding(0); editor.ValueWasChanged += new DesignerPropertyEditor.ValueChanged(editor_ValueWasChanged); editor.SetPar(rowControl.Par, _rootNode); editor.ValueWasAssigned(); if (rowControl.DefaultValueEditor != null) { this.tableLayoutPanel.Controls.Remove(rowControl.DefaultValueEditor); } rowControl.DefaultValueEditor = editor; this.tableLayoutPanel.Controls.Add(rowControl.DefaultValueEditor, 3, rowIndex + 1); return(editor); }
void createParEditor(List <ParInfo> pars, Type editorType) { foreach (ParInfo par in pars) { Label label = propertyGrid.AddProperty(par.Name, editorType, false); label.MouseEnter += new EventHandler(label_MouseEnter); DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag; editor.SetPar(par, SelectedObject); editor.MouseEnter += editor_MouseEnter; editor.ValueWasChanged += editor_ValueWasChanged; } }
private DesignerPropertyEditor createValueEditor(Type type) { Debug.Check(type != null); Type editorType = Plugin.InvokeEditorType(type); Debug.Check(editorType != null); DesignerPropertyEditor editor = (DesignerPropertyEditor)Plugin.CreateInstance(editorType); editor.AutoSize = true; editor.Dock = System.Windows.Forms.DockStyle.Fill; editor.Margin = new System.Windows.Forms.Padding(0); editor.Name = "propertyEditor"; editor.TabIndex = 4; editor.ValueWasChanged += new DesignerPropertyEditor.ValueChanged(editor_ValueWasChanged); editor.SetPar(_parTemp, _rootNode); editor.ValueWasAssigned(); return(editor); }