private TabPage AddNewProfileTab(TabControl tab, bool select = false, AxisEditor template = null) { AxisEditor newAxisEditor; TabPage newTabPage; var templateTab = tabAxis.TabPages[tabAxis.TabPages.Count - 1]; if (template == null) { newTabPage = new TabPage("Axis " + tab.TabCount) { Name = "tabAxis" }; newAxisEditor = new AxisEditor() { //Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top }; newAxisEditor.CurveResponseType = CurveResponseType.Multiplier; newAxisEditor.ResetCurve(); } else { newTabPage = new TabPage(template.CurrentSourceAxis) { Name = "tabAxis" }; newAxisEditor = template; } newAxisEditor.Location = new Point(templateTab.Padding.Left, templateTab.Padding.Top); newAxisEditor.Size = new Size(templateTab.Width - Padding.Left - Padding.Right, templateTab.Height - Padding.Top - Padding.Bottom); newAxisEditor.Index = tabAxis.TabPages.Count - 1; newTabPage.Controls.Add( newAxisEditor ); tabAxis.TabPages.Insert(tabAxis.TabPages.Count - 1, newTabPage); if( select ) tabAxis.SelectedTab = newTabPage; return newTabPage; }
private void SetupTabContextMenu() { var childControl = tabAxis.SelectedTab.Controls[0]; if (childControl.GetType() == typeof(AxisEditor)) { var axisList = DIUtils.AxisNames.ToList().Except(new string[] { tabAxis.SelectedTab.Text }).ToList(); copyCurveToToolStripMenuItem.DropDownItems.Clear(); foreach (var a in axisList) copyCurveToToolStripMenuItem.DropDownItems.Add(a); var axisEditor = tabAxis.SelectedTab.Controls[0] as AxisEditor; currentAxisEditor = axisEditor; if (axisEditor.CurveResponseType == CurveResponseType.Multiplier) { multiplier.Checked = true; value.Checked = false; } else { value.Checked = true; multiplier.Checked = false; } } }