private void Zp_button_Click(object sender, EventArgs e) { C_Pmove cp = new C_Pmove(); cp.Bt = Zp_button; cp.TAxis = Global.Z; Thread move = new Thread(new ParameterizedThreadStart(Pmove)); move.Start(cp); }
private void Ap_button_Click(object sender, EventArgs e) { C_Pmove cp = new C_Pmove(); cp.Bt = Ap_button; cp.TAxis = Global.A; cp.Dir = 1; Thread move = new Thread(new ParameterizedThreadStart(Pmove)); move.Start(cp); // Yp_button.BackColor = Color.LawnGreen; }
private void Yp_button_Click(object sender, EventArgs e) { if (checkBox6.Checked) { C_Pmove cp = new C_Pmove(); cp.Bt = Yp_button; cp.TAxis = Global.Y; cp.Dir = 0; Thread move = new Thread(new ParameterizedThreadStart(Pmove)); move.Start(cp); Yp_button.BackColor = Color.LawnGreen; } }
private void Pmove(object obj) { //缺省 速度和距离 C_Pmove cp = obj as C_Pmove; decimal len = Math.Abs(len_numericUpDown.Value); double dec = Convert.ToDouble(numericUpDown4.Value); double to = Convert.ToDouble(len); if (cp.Dir == 1) { to = -to; } cp.TAxis.Pmove(to, Convert.ToDouble(speed_numericUpDown1.Value), dec, 0); while (cp.TAxis.IsRun) { Application.DoEvents(); } }
private void Pmove(object obj) { if (checkBox6.Checked == true) { //缺省 速度和距离 C_Pmove cp = obj as C_Pmove; decimal len = Math.Abs(len_numericUpDown.Value); double dec = Convert.ToDouble(numericUpDown4.Value); double to = Convert.ToDouble(len); cp.Bt.Enabled = false; if (cp.Dir == 1) { to = -to; } cp.TAxis.Pmove(to, Convert.ToDouble(speed_numericUpDown1.Value), dec, 0); //while (cp.TAxis.IsRun) // Application.DoEvents(); cp.Bt.Enabled = true; } }