void _selectedObjectsContextMenuItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { ToolStripItem item = e.ClickedItem; if (item.Tag is DynamicCustomObject) { DynamicCustomObject dynamicObject = (DynamicCustomObject)item.Tag; CustomPropertiesControl control = new CustomPropertiesControl(); control.SelectedObject = dynamicObject; control.AutoSize = true; HostingForm form = new HostingForm("Properties", control); form.Width = 400; form.Height = 600; form.Show(); } else {// Try the chart series - this is an item of theirs. lock (this) { foreach (ChartSeries series in _series) { series.OnChartContextMenuItemClicked(item); } } } }
void seriesPropertiesMenuItem_Click(object sender, EventArgs e) { ChartSeries series = (ChartSeries)(((ToolStripItem)sender).Tag); CustomPropertiesControl control = new CustomPropertiesControl(); control.SelectedObject = series; HostingForm form = new HostingForm(series.Name + " Properties", control); form.MaximizeBox = false; form.ShowCloseButton = true; form.Show(); form.HandleDestroyed += delegate(object inSender, EventArgs inE) {// On close, update to catch any changes. this.Invalidate(); }; }