private void button1_Click(object sender, EventArgs e) { try { /* Create new Form A and create cube with textures. */ Form_3D Form_3D_A = new Form_3D(new string[] { "Form_3D/RightInv.png", "Form_3D/LeftInv.png", "Form_3D/BackInv.png", "Form_3D/FrontInv.png", "Form_3D/TopInv.png", "Form_3D/BottomInv.png" }); /* Create new Form B and create cube with textures. */ Form_3D Form_3D_B = new Form_3D(); /* Make pointer to Form. */ Form_3D_DA = Form_3D_A; Form_3D_DB = Form_3D_B; /* Start 3D form. */ Form_3D_A.Show(); Form_3D_B.Show(); /* Start timer to refresh rotate matrix of the object on the form. */ timer1.Enabled = true; } catch { MessageBox.Show(" Error ."); } }
private void ButtonStart_Click(object sender, EventArgs e) { try { /* Create new Form A and create cube with textures. */ Form_3D Form_3D_A = new Form_3D(new string[] { "Form_3D/RightInv.png", "Form_3D/LeftInv.png", "Form_3D/BackInv.png", "Form_3D/FrontInv.png", "Form_3D/TopInv.png", "Form_3D/BottomInv.png" }); Form_3D_A.Text = "Rotating Object 1"; Form_3D_A.MinimizeInsteadOfClose = true; /* Create new Form B and create cube with textures. */ Form_3D Form_3D_B = new Form_3D(); Form_3D_B.Text = "Rotating Object 2"; Form_3D_B.MinimizeInsteadOfClose = true; /* Create zGraph Form and define all paramerers for 6 curves.*/ Graph_2D Graph_2D_A = new Graph_2D( new string[] { "X", "Y", "Z", }, new Color[] { Color.Aqua, Color.Black, Color.Blue, }, "Graph Accel", " Time , milliSec ", " Value of parameters" ); /* Create zGraph Form and define all paramerers for 2 curves.*/ Graph_2D Graph_2D_B = new Graph_2D( new string[] { "X", "Y", "Z", }, new Color[] { Color.Aqua, Color.Red, Color.Green }, "Graph Magnetometer", " Time , milliSec ", " Value of parameters" ); /* Create zGraph Form and define all paramerers for 2 curves.*/ Graph_2D Graph_2D_C = new Graph_2D( new string[] { "Pitch", "Roll", "Yaw", }, new Color[] { Color.Aqua, Color.Red, Color.Green }, "Graph C", " Time , milliSec ", " Degree" ); /* Make pointer to Form. */ Form_3D_DA = Form_3D_A; Form_3D_DB = Form_3D_B; Graph_2D_DA = Graph_2D_A; Graph_2D_DB = Graph_2D_B; Graph_2D_DC = Graph_2D_C; /* Start 3D form. */ Form_3D_A.Show(); Form_3D_B.Show(); /* We should give different name for each form to make possible save form parameters to file.*/ Graph_2D_A.Text = "zGraph N1"; // Graph_2D_A.MinimizeInsteadOfClose = true; Graph_2D_A.Show(); Graph_2D_B.Text = "zGraph N2"; // Graph_2D_B.MinimizeInsteadOfClose = true; Graph_2D_B.Show(); Graph_2D_C.Text = "Angle"; // Graph_2D_B.MinimizeInsteadOfClose = true; Graph_2D_C.Show(); //serialPort1.WriteLine("T"); /* Start timer to refresh rotate matrix of the object on the form. */ timer1.Enabled = true; } catch { MessageBox.Show(" Error ."); } }