private void splineTabs_Selected(object sender, TabControlEventArgs e) { // Get the selected tab SplineTab tab = e.TabPage as SplineTab; // Is there a tab? if (tab != null) { // Add tabs events KeyDown += tab.SplineKeyDown; tmrInterpolate.Tick += tab.SplineTick; tab.SplineCameraMove += CameraMove; tab.SplineKnotInserted += Knot_Insert_Remove; tab.SplineKnotRemoved += Knot_Insert_Remove; tab.SplineMouseMove += TabMouseMove; tab.MouseLeave += TabMouseExit; // Set editing buttons based tabs settings btnBezierMode.Enabled = !tab.BezierMode; btnHermiteMode.Enabled = tab.BezierMode; chkbInterpolate.Checked = tab.InterpolationActive; nudTimer.Maximum = tab.Segments(); nudTimer.Value = (decimal)tab.InterpolationTime; nudCamX.Value = (decimal)tab.Camera.x; nudCamY.Value = (decimal)tab.Camera.y; } }
private void Form1_Load(object sender, EventArgs e) { nudCamX.Minimum = decimal.MinValue; nudCamX.Maximum = decimal.MaxValue; nudCamY.Minimum = decimal.MinValue; nudCamY.Maximum = decimal.MaxValue; // Create the initial tab SplineTab tab = new SplineTab(splineTabs.Size); // Set this tab to be the const tab tab.Name = "spline0"; tab.Text = "Spline1"; // Add this tab to the tab control splineTabs.TabPages.Add(tab); // Set the selected tab splineTabs.SelectTab(0); // Set the initial events for this tab KeyDown += tab.SplineKeyDown; tmrInterpolate.Tick += tab.SplineTick; tab.SplineCameraMove += CameraMove; tab.SplineKnotInserted += Knot_Insert_Remove; tab.SplineKnotRemoved += Knot_Insert_Remove; tab.SplineMouseMove += TabMouseMove; tab.MouseLeave += TabMouseExit; // Set starting mode based on splines default mode btnBezierMode.Enabled = !tab.BezierMode; btnHermiteMode.Enabled = tab.BezierMode; nudCamX.Value = (decimal)tab.Camera.x; nudCamY.Value = (decimal)tab.Camera.y; nudTimer.Maximum = tab.Segments(); // Disable close button btnClose.Enabled = false; // Set one tab to be created m_TabsCreated = 1; // Start the timer tmrInterpolate.Start(); }
private void Knot_Insert_Remove(object sender, SplineEventArgs e) { // Get the sender as a spline tab SplineTab tab = sender as SplineTab; // Assure tab isn't null if (tab != null) { // Set maximum value of timer to splines segments nudTimer.Maximum = tab.Segments(); // Set timers value nudTimer.Value = (decimal)tab.InterpolationTime; } }