public CustomisePanel() { InitializeComponent(); _fieldTable = new CustomFieldDataTable("CustomFields"); _fieldGrid = new CustomiseFieldDataGridView { Dock = DockStyle.Fill, DataSource = _fieldTable }; _fieldGrid.SelectionChanged += FieldGridSelectionChanged; // // Create the field toolstrip. // var toolStrip = new ToolStrip { GripStyle = ToolStripGripStyle.Hidden, BackColor = LookAndFeel.Color.ToolStrip, Renderer = new ToolStripRenderer() }; TopToolStripPanel.Join(toolStrip); _newFieldButton = new ToolStripButton { Image = Properties.Resources.NewCustomField, ImageTransparentColor = Color.Magenta, ToolTipText = "Create a new custom field" }; _newFieldButton.Click += NewFieldButtonClick; _editFieldButton = new ToolStripButton { Image = Properties.Resources.EditCustomField, ImageTransparentColor = Color.Magenta, ToolTipText = "Edit the selected custom field" }; _editFieldButton.Click += EditFieldButtonClick; _deleteFieldButton = new ToolStripButton { Image = Properties.Resources.DeleteCustomField, ImageTransparentColor = Color.Magenta, ToolTipText = "Delete the selected custom field" }; _deleteFieldButton.Click += DeleteFieldButtonClick; _categoryComboBox = new ToolStripComboBox { DropDownStyle = ComboBoxStyle.DropDownList }; var customFields = new CustomFieldCollection(Properties.Resources.CustomFields); foreach (CustomFieldCategory category in customFields.Fields.Values) { _categoryComboBox.Items.Add(category); } if (_categoryComboBox.Items.Count > 0) { _categoryComboBox.SelectedIndex = 0; } _addCategoryButton = new ToolStripButton { Image = Properties.Resources.AddCategoryFields, ImageTransparentColor = Color.Magenta, ToolTipText = "Add custom fields for the selected category" }; _addCategoryButton.Click += AddCategoryButtonClick; toolStrip.Items.Add(_newFieldButton); toolStrip.Items.Add(_editFieldButton); toolStrip.Items.Add(_deleteFieldButton); toolStrip.Items.Add(new ToolStripSeparator()); toolStrip.Items.Add(_categoryComboBox); toolStrip.Items.Add(_addCategoryButton); var menu = new ToolStripMenuItem("Action"); SetMenuStrip(menu); _newFieldMenuItem = new ToolStripMenuItem("New Field...", _newFieldButton.Image); _newFieldMenuItem.Click += NewFieldButtonClick; menu.DropDownItems.Add(_newFieldMenuItem); _editFieldMenuItem = new ToolStripMenuItem("Edit Field...", _editFieldButton.Image); _editFieldMenuItem.Click += EditFieldButtonClick; menu.DropDownItems.Add(_editFieldMenuItem); _deleteFieldMenuItem = new ToolStripMenuItem("Delete Field(s)", _deleteFieldButton.Image); _deleteFieldMenuItem.Click += DeleteFieldButtonClick; menu.DropDownItems.Add(_deleteFieldMenuItem); ContentPanel.Controls.Add(_fieldGrid); UpdateUiState(); }