private void bt_return_Click(object sender, EventArgs e) { GCode_Test State = (GCode_Test)this.Owner;//将本窗体的拥有者强制设为Form1类的实例f1 State.zeroState(0); this.Close(); }
/// <summary> /// 返回主页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bt_return_Click(object sender, EventArgs e) { if (returnToZeroState() != 1) { MessageBox.Show("请将各轴先回零", "提示"); } else if (returnToZeroState() == 1) { GCode_Test State = (GCode_Test)this.Owner;//将本窗体的拥有者强制设为Form1类的实例f1 State.zeroState(1); gCodeService.GCode_handWheel_stop(); this.Close(); } }