123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- 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<CutHole> 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;
- }
- }
- }
- }
|