protected override CollectionForm CreateCollectionForm() { //获取属性浏览对象 CollectionForm frm = base.CreateCollectionForm(); FieldInfo fieldInfo = frm.GetType().GetField("propertyBrower", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { PropertyGrid pgrid = fieldInfo.GetValue(frm) as PropertyGrid; pgrid.PropertyValueChanged += Pgrid_PropertyValueChanged; pgrid.SelectedObjectsChanged += ExtendCollectionEditor_ValueChange; } //注册按钮事件 #region FieldInfo removeButton = frm.GetType().GetField("removeButton", BindingFlags.NonPublic | BindingFlags.Instance); if (removeButton != null) { (removeButton.GetValue(frm) as Button).Click += ExtendCollectionEditor_RemoveClick; } FieldInfo cancelButton = frm.GetType().GetField("cancelButton", BindingFlags.NonPublic | BindingFlags.Instance); if (cancelButton != null) { (cancelButton.GetValue(frm) as Button).Click += ExtendCollectionEditor_ValueChange; } FieldInfo okButton = frm.GetType().GetField("okButton", BindingFlags.NonPublic | BindingFlags.Instance); if (okButton != null) { } #endregion return(frm); }
protected override CollectionForm CreateCollectionForm() { CollectionForm form = base.CreateCollectionForm(); Type t = form.GetType(); FieldInfo f; if ((f = t.GetField("addButton", BindingFlags.Instance | BindingFlags.NonPublic)) != null) { (f.GetValue(form) as Control).Visible = false; } if ((f = t.GetField("removeButton", BindingFlags.Instance | BindingFlags.NonPublic)) != null) { (f.GetValue(form) as Control).Visible = false; } if ((f = t.GetField("downButton", BindingFlags.Instance | BindingFlags.NonPublic)) != null) { (f.GetValue(form) as Control).Visible = false; } if ((f = t.GetField("upButton", BindingFlags.Instance | BindingFlags.NonPublic)) != null) { (f.GetValue(form) as Control).Visible = false; } return(form); }
protected override CollectionForm CreateCollectionForm() { CollectionForm form = base.CreateCollectionForm(); Type type = form.GetType(); PropertyInfo propertyInfo = type.GetProperty("CollectionEditable", BindingFlags.Instance | BindingFlags.NonPublic); propertyInfo?.SetValue(form, true); return(form); }
/// <summary> /// Takes the base collection form and apply some changes. /// </summary> /// <remarks> /// This method uses reflection to change the internal collection editor dialog on-thy-fly. /// </remarks> /// <returns>The changed form is beeing returned completely.</returns> protected override CollectionForm CreateCollectionForm() { CollectionForm form = base.CreateCollectionForm(); form.FormBorderStyle = FormBorderStyle.SizableToolWindow; form.Text = "<AREA> Editor"; Type t = form.GetType(); // Get the private variables via Reflection FieldInfo fieldInfo; fieldInfo = t.GetField("propertyBrowser", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { PropertyGrid propertyGrid = (PropertyGrid)fieldInfo.GetValue(form); if (propertyGrid != null) { propertyGrid.ToolbarVisible = false; propertyGrid.HelpVisible = true; } } fieldInfo = t.GetField("helpButton", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { Button removeButton = (Button)fieldInfo.GetValue(form); removeButton.Visible = false; } fieldInfo = t.GetField("addButton", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { Button addButton = (Button)fieldInfo.GetValue(form); addButton.Text = ResourceManager.GetString("AreaCollectionEditor.addButton.Text"); addButton.FlatStyle = FlatStyle.System; } fieldInfo = t.GetField("okButton", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { Button okButton = (Button)fieldInfo.GetValue(form); okButton.Left += okButton.Width + 3; okButton.FlatStyle = FlatStyle.System; } fieldInfo = t.GetField("cancelButton", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { Button cancelButton = (Button)fieldInfo.GetValue(form); cancelButton.Left += cancelButton.Width + 3; cancelButton.FlatStyle = FlatStyle.System; } Label memberLabel = new Label(); memberLabel.Text = ResourceManager.GetString("AreaCollectionEditor.memberLabel.Text"); memberLabel.Location = new Point(10, 8); memberLabel.Size = new Size(200, 15); form.Controls.Add(memberLabel); memberLabel.BringToFront(); return(form); }
// 开启属性描述 protected override CollectionForm CreateCollectionForm() { CollectionForm frm = base.CreateCollectionForm(); FieldInfo fileinfo = frm.GetType() .GetField("propertyBrowser", BindingFlags.NonPublic | BindingFlags.Instance); if (fileinfo != null) { (fileinfo.GetValue(frm) as System.Windows.Forms.PropertyGrid).HelpVisible = true; } return(frm); }
/// <summary> /// Creates a new form to display and edit the current collection. /// </summary> /// <returns>A <see cref="CollectionEditor.CollectionForm"/> to provide as the user interface for editing the collection.</returns> protected override CollectionForm CreateCollectionForm() { _mForm = base.CreateCollectionForm(); _mForm.Text = _mEditorAttribute.Title ?? _mForm.Text; Type formType = _mForm.GetType(); PropertyInfo pi = formType.GetProperty("CollectionEditable", BindingFlags.NonPublic | BindingFlags.Instance); pi.SetValue(_mForm, true, null); return(_mForm); }
private void CloneButton_Click(object sender, EventArgs e) { if (lb.SelectedItem == null) { return; } PropertyInfo propInfo = lb.SelectedItem.GetType().GetProperty("Value"); var orgObject = propInfo.GetValue(lb.SelectedItem) as T; MethodInfo methodInfo = m_collectionForm.GetType().GetMethod("AddItems", BindingFlags.NonPublic | BindingFlags.Instance); methodInfo.Invoke(m_collectionForm, new object[] { Enumerable.Repeat(orgObject.Clone(), 1).ToList() }); }
protected void ExtendCollectionEditor_RemoveClick(object sender, EventArgs e) { CollectionForm frm = (sender as Button).Parent.Parent.Parent as CollectionForm; FieldInfo listbox = frm.GetType().GetField("listbox", BindingFlags.NonPublic | BindingFlags.Instance); ListBox listb = listbox.GetValue(frm) as ListBox; PropertyInfo Items = frm.GetType().GetProperty("Items", BindingFlags.NonPublic | BindingFlags.Instance); PropertyInfo ListItem = null; object[] items = new object[listb.Items.Count]; for (int i = 0; i < listb.Items.Count; i++) { if (ListItem == null) { ListItem = listb.Items[i].GetType().GetProperty("Value", BindingFlags.Public | BindingFlags.Instance); } items[i] = ListItem.GetValue(listb.Items[i]); } Items.SetValue(frm, items); AfterRemove(); }
/// <summary> /// 创建一个新的窗体来显示和编辑当前集合 /// </summary> /// <returns>一个 System.ComponentModel.Design.CollectionEditor.CollectionForm 作为用户界面提供用于编辑集合</returns> protected override CollectionForm CreateCollectionForm() { CollectionForm frm = base.CreateCollectionForm(); FieldInfo fileinfo = frm.GetType().GetField("propertyBrowser", BindingFlags.NonPublic | BindingFlags.Instance); if (fileinfo != null) { (fileinfo.GetValue(frm) as System.Windows.Forms.PropertyGrid).HelpVisible = true; } frm.Width = 700; frm.Height = 600; FieldInfo listboxFieldInfo = frm.GetType().GetField("listbox", BindingFlags.NonPublic | BindingFlags.Instance); this._listbox = listboxFieldInfo.GetValue(frm) as ListBox; //注册按钮事件 this.ReflectButtonEvent(frm); //_frm = frm; return(frm); }
protected override CollectionForm CreateCollectionForm() { CollectionForm frm = base.CreateCollectionForm(); FieldInfo fieldInfo = frm.GetType().GetField("propertyBrowser", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { (fieldInfo.GetValue(frm) as System.Windows.Forms.PropertyGrid).HelpVisible = true; } frm.Width = 700; frm.Height = 600; frm.ControlBox = false; #region 注册按钮事件 FieldInfo removeButton = frm.GetType().GetField("removeButton", BindingFlags.NonPublic | BindingFlags.Instance); if (removeButton != null) { (removeButton.GetValue(frm) as Button).Click += ButtonRemove_Click; } FieldInfo cancelButton = frm.GetType().GetField("cancelButton", BindingFlags.NonPublic | BindingFlags.Instance); if (cancelButton != null) { (cancelButton.GetValue(frm) as Button).Click += ButtonCancel_Click; } FieldInfo okButton = frm.GetType().GetField("okButton", BindingFlags.NonPublic | BindingFlags.Instance); if (okButton != null) { (okButton.GetValue(frm) as Button).Click += ButtonOk_Click; } #endregion return(frm); }
/// <summary> /// Creates a new form to display and edit the current collection. /// </summary> /// <returns>A <see cref="CollectionEditor.CollectionForm"/> to provide as the user interface for editing the collection.</returns> protected override CollectionForm CreateCollectionForm() { m_Form = base.CreateCollectionForm(); m_Form.Text = m_EditorAttribute.Title ?? "Редактор словаря"; // Die Eigenschaft "CollectionEditable" muss hier per Reflection gesetzt werden (ist protected) var formType = m_Form.GetType(); var pi = formType.GetProperty("CollectionEditable", BindingFlags.NonPublic | BindingFlags.Instance); if (pi != null) { pi.SetValue(m_Form, true, null); } return(m_Form); }
/// <summary> /// Creates a new CollectionForm to display the collection editor /// </summary> /// <remarks> /// This methods uses reflection to access non-public fields/properties within the collectionform. /// This method can also be used to alter other visual aspects of the form. /// </remarks> /// <returns>CollectionForm</returns> protected override CollectionForm CreateCollectionForm() { _form = base.CreateCollectionForm(); //Get the forms type var formType = _form.GetType(); //Get a reference to the private fieldtype propertyBrowser //This is the propertgrid inside the collectionform var fieldInfo = formType.GetField("propertyBrowser", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { //get a reference to the propertygrid instance located on the form _propGrid = (PropertyGrid)fieldInfo.GetValue(_form); if (_propGrid != null) { _propGrid.ToolbarVisible = true; _propGrid.HelpVisible = true; _propGrid.PropertySort = PropertySort.Categorized; /*//Get the property grid's type. * //Note that this is a vsPropertyGrid located in System.Windows.Forms.Design * Type propertyGridType = _propGrid.GetType(); * * //Get a reference to the non-public property ToolStripRenderer * PropertyInfo propertyInfo = propertyGridType.GetProperty("ToolStripRenderer", BindingFlags.NonPublic | BindingFlags.Instance); * * if (propertyInfo != null) * { * //Assign a ToolStripProfessionalRenderer with our custom color table * propertyInfo.SetValue(_propGrid, new ToolStripProfessionalRenderer(new CustomColorTable()), null); * }*/ } } _form.Shown += OnFormShow; // InitializeComponent(); return(_form); }
private void ReflectButtonEvent(CollectionForm frm) { FieldInfo okButton = frm.GetType().GetField("okButton", BindingFlags.NonPublic | BindingFlags.Instance); if (okButton != null) { (okButton.GetValue(frm) as Button).Click += Ok_Click;; } //FieldInfo removeButton = frm.GetType().GetField("removeButton", BindingFlags.NonPublic | BindingFlags.Instance); //if (removeButton != null) //{ // (removeButton.GetValue(frm) as Button).Click += ExtendCollectionEditor_RemoveClick; //} //FieldInfo cancelButton = frm.GetType().GetField("cancelButton", BindingFlags.NonPublic | BindingFlags.Instance); //if (cancelButton != null) //{ // (cancelButton.GetValue(frm) as Button).Click += ExtendCollectionEditor_ValueChange; //} //FieldInfo okButton = frm.GetType().GetField("okButton", BindingFlags.NonPublic | BindingFlags.Instance); //if (okButton != null) //{ //} //FieldInfo upButton = frm.GetType().GetField("upButton", BindingFlags.NonPublic | BindingFlags.Instance); //if (upButton != null) //{ //} //FieldInfo downButton = frm.GetType().GetField("downButton", BindingFlags.NonPublic | BindingFlags.Instance); //if (downButton != null) //{ //} }
/// <summary> /// Creates a new CollectionForm to display the collection editor /// </summary> /// <remarks> /// This methods uses reflection to access non-public fields/properties within the CollectionForm. /// This method can also be used to alter other visual aspects of the Form. /// </remarks> /// <returns>CollectionForm</returns> protected override CollectionForm CreateCollectionForm() { _form = base.CreateCollectionForm(); HandleFormCollectionType(); // hook events for expanding Criteria properties hierarchy if (_collectionType == typeof(Criteria)) { foreach (Control control in _form.Controls) { if (control is TableLayoutPanel) { foreach (var panelControl in control.Controls) { if (panelControl is ListBox) { ((ListBox)panelControl).SelectedIndexChanged += OnIndexChanged; } else if (panelControl is TableLayoutPanel) { var layoutPanel = (TableLayoutPanel)panelControl; foreach (var tableControl in layoutPanel.Controls) { if (tableControl is Button) { var button = (Button)tableControl; if (button.Text.IndexOf("Add", StringComparison.InvariantCulture) > 0 || button.Text.IndexOf("Remove", StringComparison.InvariantCulture) > 0) { button.Click += OnItemAddedOrRemoved; } } } } else if (panelControl is PropertyGrid) { ((PropertyGrid)panelControl).SelectedGridItemChanged += OnGridItemChanged; } } } } } else if (_collectionType == typeof(ValueProperty) || _collectionType == typeof(ChildProperty)) { foreach (Control control in _form.Controls) { if (control is TableLayoutPanel) { foreach (var panelControl in control.Controls) { if (panelControl is PropertyGrid) { ((PropertyGrid)panelControl).SelectedGridItemChanged += OnGridItemChangedProperty; } if (panelControl is TableLayoutPanel) { var layoutPanel = (TableLayoutPanel)panelControl; if (layoutPanel.Name == "okCancelTableLayoutPanel") { foreach (var tableControl in layoutPanel.Controls) { if (tableControl is Button) { var button = (Button)tableControl; if (button.Name == "cancelButton" || button.Name == "okButton") { _exitButton[button.Name] = button; button.Click += ExitButtonClickHandler; } } } } } } } } } /*else if (_collectionType == typeof (BusinessRuleProperty)) * { * // hide Add & Remove buttons * foreach (Control control in _form.Controls) * { * if (control is TableLayoutPanel) * { * foreach (var panelControl in control.Controls) * { * if (panelControl is TableLayoutPanel) * { * var layoutPanel = (TableLayoutPanel) panelControl; * foreach (var tableControl in layoutPanel.Controls) * { * if (tableControl is Button) * { * var button = (Button) tableControl; * if (button.Text.IndexOf("Add") > 0 || button.Text.IndexOf("Remove") > 0) * { * button.Hide(); * button.Enabled = false; * } * } * } * } * } * } * } * }*/ else if (_collectionType == typeof(BusinessRuleConstructor)) { // hide Add & Remove buttons foreach (Control control in _form.Controls) { if (control is TableLayoutPanel) { foreach (var panelControl in control.Controls) { if (panelControl is TableLayoutPanel) { var layoutPanel = (TableLayoutPanel)panelControl; if (layoutPanel.Name == "addRemoveTableLayoutPanel") { foreach (var tableControl in layoutPanel.Controls) { if (tableControl is Button) { var button = (Button)tableControl; if (button.Name == "addButton" || button.Name == "removeButton") { button.Hide(); button.Enabled = false; } } } } } } } } } var formType = _form.GetType(); //Get a reference to the private fieldtype propertyBrowser //This is the PropertGrid inside the CollectionForm var fieldInfo = formType.GetField("propertyBrowser", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { _propGrid = (PropertyGrid)fieldInfo.GetValue(_form); if (_propGrid != null) { _propGrid.ToolbarVisible = true; _propGrid.HelpVisible = true; _propGrid.PropertySort = PropertySort.Categorized; _propGrid.PropertySortChanged += OnSort; _propGrid.SelectedObjectsChanged += OnSelect; /*//Get the property grid's type. * //This is a vsPropertyGrid located in System.Windows.Forms.Design * Type propertyGridType = _propGrid.GetType(); * * //Get a reference to the non-public property ToolStripRenderer * PropertyInfo propertyInfo = propertyGridType.GetProperty("ToolStripRenderer", BindingFlags.NonPublic | BindingFlags.Instance); * * if (propertyInfo != null) * { * //Assign a ToolStripProfessionalRenderer with our custom color table * propertyInfo.SetValue(_propGrid, new ToolStripProfessionalRenderer(new CustomColorTable()), null); * }*/ } } _form.Shown += OnFormShow; return(_form); }
/// <summary> /// Takes the base collection form and apply some changes. /// </summary> /// <remarks> /// This method uses reflection to change the internal collection editor dialog on-thy-fly. /// </remarks> /// <returns>The changed form is beeing returned completely.</returns> protected override CollectionForm CreateCollectionForm() { CollectionForm form = base.CreateCollectionForm(); form.FormBorderStyle = FormBorderStyle.SizableToolWindow; form.Text = "<OPTION> Editor"; Type t = form.GetType(); // Get the private variables via Reflection FieldInfo fieldInfo; fieldInfo = t.GetField("propertyBrowser", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { PropertyGrid propertyGrid = (PropertyGrid)fieldInfo.GetValue(form); if (propertyGrid != null) { propertyGrid.ToolbarVisible = false; propertyGrid.HelpVisible = true; } } fieldInfo = t.GetField("upButton", BindingFlags.NonPublic | BindingFlags.Instance); // we add the events here to force the underlying collection beeing reordered after each up/down step to // allow the application to refresh the display of the element even on order steps if (fieldInfo != null) { Button upButton = (Button)fieldInfo.GetValue(form); } fieldInfo = t.GetField("downButton", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { Button downButton = (Button)fieldInfo.GetValue(form); } fieldInfo = t.GetField("helpButton", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { Button removeButton = (Button)fieldInfo.GetValue(form); removeButton.Visible = false; } fieldInfo = t.GetField("addButton", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { Button addButton = (Button)fieldInfo.GetValue(form); addButton.Text = ResourceManager.GetString("OptionCollectionEditor.addButton.Text"); } fieldInfo = t.GetField("removeButton", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { Button removeButton = (Button)fieldInfo.GetValue(form); removeButton.Text = ResourceManager.GetString("OptionCollectionEditor.removeButton.Text"); } fieldInfo = t.GetField("okButton", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { Button okButton = (Button)fieldInfo.GetValue(form); okButton.Left += okButton.Width + 3; } fieldInfo = t.GetField("cancelButton", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { Button cancelButton = (Button)fieldInfo.GetValue(form); cancelButton.Left += cancelButton.Width + 3; } Label memberLabel = new Label(); memberLabel.Text = ResourceManager.GetString("OptionCollectionEditor.memberLabel.Text"); memberLabel.Location = new Point(10, 8); memberLabel.Size = new Size(200, 15); form.Controls.Add(memberLabel); memberLabel.BringToFront(); return(form); }
/// <summary> /// Creates a new CollectionForm to display the collection editor /// </summary> /// <remarks> /// This methods uses reflection to access non-public fields/properties within the collectionform. /// This method can also be used to alter other visual aspects of the form. /// </remarks> /// <returns>CollectionForm</returns> protected override CollectionForm CreateCollectionForm() { _form = base.CreateCollectionForm(); HandleFormCollectionType(); // hook events for expanding Criteria properties hierarchy if (_collectionType == typeof(Criteria)) { foreach (Control control in _form.Controls) { if (control is TableLayoutPanel) { foreach (var panelControl in control.Controls) { if (panelControl is ListBox) { ((ListBox)panelControl).SelectedIndexChanged += OnIndexChanged; } if (panelControl is TableLayoutPanel) { var layoutPanel = (TableLayoutPanel)panelControl; foreach (var tableControl in layoutPanel.Controls) { if (tableControl is Button) { var button = (Button)tableControl; if (button.Text.IndexOf("Add") > 0 || button.Text.IndexOf("Remove") > 0) { button.Click += OnItemAddedOrRemoved; } } } } } } } } var formType = _form.GetType(); //Get a reference to the private fieldtype propertyBrowser //This is the propertgrid inside the collectionform var fieldInfo = formType.GetField("propertyBrowser", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { _propGrid = (PropertyGrid)fieldInfo.GetValue(_form); if (_propGrid != null) { _propGrid.ToolbarVisible = true; _propGrid.HelpVisible = true; _propGrid.PropertySort = PropertySort.Categorized; _propGrid.PropertySortChanged += OnSort; _propGrid.SelectedObjectsChanged += OnSelect; /*//Get the property grid's type. * //This is a vsPropertyGrid located in System.Windows.Forms.Design * Type propertyGridType = _propGrid.GetType(); * * //Get a reference to the non-public property ToolStripRenderer * PropertyInfo propertyInfo = propertyGridType.GetProperty("ToolStripRenderer", BindingFlags.NonPublic | BindingFlags.Instance); * * if (propertyInfo != null) * { * //Assign a ToolStripProfessionalRenderer with our custom color table * propertyInfo.SetValue(_propGrid, new ToolStripProfessionalRenderer(new CustomColorTable()), null); * }*/ } } _form.Shown += OnFormShow; return(_form); }
/// <summary> /// Takes the base collection form and apply some changes. /// </summary> /// <remarks> /// This method uses reflection to change the internal collection editor dialog on-thy-fly. /// </remarks> /// <returns>The changed form is beeing returned completely.</returns> protected override CollectionForm CreateCollectionForm() { CollectionForm form = base.CreateCollectionForm(); form.FormBorderStyle = FormBorderStyle.SizableToolWindow; form.Text = "<OPTION><OPTGROUP> Editor"; Type t = form.GetType(); // Get the private variables via Reflection FieldInfo fieldInfo; fieldInfo = t.GetField("propertyBrowser", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { PropertyGrid propertyGrid = (PropertyGrid)fieldInfo.GetValue(form); if (propertyGrid != null) { propertyGrid.ToolbarVisible = false; propertyGrid.HelpVisible = true; } } fieldInfo = t.GetField("upButton", BindingFlags.NonPublic | BindingFlags.Instance); // we add the events here to force the underlying collection beeing reordered after each up/down step to // allow the application to refresh the display of the element even on order steps if (fieldInfo != null) { Button upButton = (Button)fieldInfo.GetValue(form); } fieldInfo = t.GetField("downButton", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { Button downButton = (Button)fieldInfo.GetValue(form); } fieldInfo = t.GetField("helpButton", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { Button removeButton = (Button)fieldInfo.GetValue(form); removeButton.Visible = false; } fieldInfo = t.GetField("addButton", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { Button addButton = (Button)fieldInfo.GetValue(form); addButton.Text = ResourceManager.GetString("OptionCollectionEditor.addButton.Text"); } fieldInfo = t.GetField("addDownButton", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { Button addDownButton = (Button)fieldInfo.GetValue(form); addDownButton.BackColor = SystemColors.Control; addDownButton.ImageList = null; // we modify the image because the original one has a terrible gray background... addDownButton.Image = Image.FromStream(stream); } fieldInfo = t.GetField("addDownMenu", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { switch (fieldInfo.GetValue(form).GetType().Name) { case "ContextMenu": ContextMenu addMenu = (ContextMenu)fieldInfo.GetValue(form); if (addMenu.MenuItems.Count == 2) { addMenu.MenuItems[0].Text = "<OPTION>"; addMenu.MenuItems[1].Text = "<OPTGROUP>"; } break; # if !DOTNET20 case "ContextMenuStrip": ContextMenuStrip ctxMenu = (ContextMenuStrip)fieldInfo.GetValue(form); if (ctxMenu.Items.Count == 2) { ctxMenu.Items[0].Text = "<OPTION>"; ctxMenu.Items[1].Text = "<OPTGROUP>"; } break; # endif } } fieldInfo = t.GetField("removeButton", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { Button removeButton = (Button)fieldInfo.GetValue(form); removeButton.Text = ResourceManager.GetString("OptionCollectionEditor.removeButton.Text"); } fieldInfo = t.GetField("okButton", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { Button okButton = (Button)fieldInfo.GetValue(form); okButton.Left += okButton.Width + 3; } fieldInfo = t.GetField("cancelButton", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { Button cancelButton = (Button)fieldInfo.GetValue(form); cancelButton.Left += cancelButton.Width + 3; } Label memberLabel = new Label(); memberLabel.Text = ResourceManager.GetString("OptionCollectionEditor.memberLabel.Text"); memberLabel.Location = new Point(10, 8); memberLabel.Size = new Size(200, 15); form.Controls.Add(memberLabel); memberLabel.BringToFront(); return(form); }