using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace HOZProject { public partial class UControl_Init : UserControl { private FormHOZMain formHOZMain; public FormHOZMain FormHOZMainObject { get => formHOZMain; set => formHOZMain = value; } public UControl_Init(FormHOZMain formHOZ) { InitializeComponent(); FormHOZMainObject = formHOZ; } private void btnClose_Click(object sender, EventArgs e) { Form fParent = this.ParentForm; fParent.Close(); } private void pbCutHoleFile_Click(object sender, EventArgs e) { if (FormHOZMainObject.m_MeasureFile == null) { MessageBox.Show("请新建一个测量文件"); } else { if (!FormHOZMainObject.m_MeasureFile.GetCutHolesFromFile("")) { MessageBox.Show("导入切孔失败"); } else { int cutHoleCount = FormHOZMainObject.m_MeasureFile.ListCutHole.Count; FormHOZMainObject.CreateCutHoleList(cutHoleCount); } //this.CutHoleGridView.Rows.Clear(); //List listHoles = m_MeasureFile.ListCutHole; //foreach (CutHole hole in listHoles) //{ // //在CutHoleGridView中,添加切孔信息 // int index = this.CutHoleGridView.Rows.Add(); // this.CutHoleGridView.Rows[index].Cells[0].Value = hole.HoleName; // SemPosition pos = hole.Position; // this.CutHoleGridView.Rows[index].Cells[1].Value = pos.X; // this.CutHoleGridView.Rows[index].Cells[2].Value = pos.Y; // this.CutHoleGridView.Rows[index].Cells[3].Value = pos.Z; // this.CutHoleGridView.Rows[index].Cells[4].Value = pos.M; // this.CutHoleGridView.Rows[index].Cells[5].Value = pos.R; // this.CutHoleGridView.Rows[index].Cells[6].Value = pos.T; //} } } private void button1_Click(object sender, EventArgs e) { if (FormHOZMainObject.m_MeasureFile == null) { MessageBox.Show("请新建一个测量文件"); //this.listmsg.Items.Add("请新建一个测量文件"); } else { FormHOZMainObject.m_MeasureFile.MParam.PT = this.cBIsPT.Checked; FormHOZMainObject.m_MeasureFile.MParam.SampleName = this.tBSampleName.Text; FormHOZMainObject.m_MeasureFile.MParam.FIBTemp = this.tBFIBTemp.Text; FormHOZMainObject.m_MeasureFile.MParam.FocusMode = this.cBIsManul.Checked; MessageBox.Show("参数设置成功"); } } private void pbTemplateFile_Click(object sender, EventArgs e) { string FilePathName; string fileNameWithoutExtension; //新建一个文件对话框 OpenFileDialog pOpenFileDialog = new OpenFileDialog(); //设置对话框标题 pOpenFileDialog.Title = "选择模板文件"; //设置打开文件类型 pOpenFileDialog.Filter = "ely文件(*.ely)|*.ely"; //监测文件是否存在 pOpenFileDialog.CheckFileExists = true; //文件打开后执行以下程序 if (pOpenFileDialog.ShowDialog() == DialogResult.OK) { FilePathName = System.IO.Path.GetFullPath(pOpenFileDialog.FileName); //绝对路径 fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(FilePathName); this.tBFIBTemp.Text = fileNameWithoutExtension; } } } }