private void button5_Click(object sender, EventArgs e) { try { frmClose = true; MotorXValue[NowCount] = MotorXValue[NowCount] + double.Parse(label7.Text); MotorYValue[NowCount] = MotorYValue[NowCount] + double.Parse(label8.Text); string strPath; strPath = System.Windows.Forms.Application.StartupPath + "\\DOC\\FormOffsetCorValue.ini"; CIni IniProg = new CIni(strPath); string strTemp = ""; for (int i = 0; i <= MotorXValue.GetUpperBound(0); i++) { strTemp = MotorXValue[i].ToString(); IniProg.IniWriteValue("MotorX", i.ToString(), strTemp); } for (int i = 0; i <= MotorYValue.GetUpperBound(0); i++) { strTemp = MotorYValue[i].ToString(); IniProg.IniWriteValue("MotorY", i.ToString(), strTemp); } } catch { MessageBox.Show("失败,请检查格式是否正确"); } //label7.Text = "0"; //label8.Text = "0"; this.Dispose(); }
private void FormOffsetCorValue_FormClosing(object sender, FormClosingEventArgs e) { if (!frmClose) { MessageBox.Show("请保存再退出"); MotorXValue[NowCount] = MotorXValue[NowCount] + double.Parse(label7.Text); MotorYValue[NowCount] = MotorYValue[NowCount] + double.Parse(label8.Text); string strPath; strPath = System.Windows.Forms.Application.StartupPath + "\\DOC\\FormOffsetCorValue.ini"; CIni IniProg = new CIni(strPath); string strTemp = "0"; for (int i = 0; i <= MotorXValue.GetUpperBound(0); i++) { strTemp = MotorXValue[i].ToString(); IniProg.IniWriteValue("MotorX", i.ToString(), strTemp); } for (int i = 0; i <= MotorYValue.GetUpperBound(0); i++) { strTemp = MotorYValue[i].ToString(); IniProg.IniWriteValue("MotorY", i.ToString(), strTemp); } } }