UControl_Init.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace HOZProject
  11. {
  12. public partial class UControl_Init : UserControl
  13. {
  14. private FormHOZMain formHOZMain;
  15. public FormHOZMain FormHOZMainObject { get => formHOZMain; set => formHOZMain = value; }
  16. public UControl_Init(FormHOZMain formHOZ)
  17. {
  18. InitializeComponent();
  19. FormHOZMainObject = formHOZ;
  20. }
  21. private void btnClose_Click(object sender, EventArgs e)
  22. {
  23. Form fParent = this.ParentForm;
  24. fParent.Close();
  25. }
  26. private void pbCutHoleFile_Click(object sender, EventArgs e)
  27. {
  28. if (FormHOZMainObject.m_MeasureFile == null)
  29. {
  30. MessageBox.Show("请新建一个测量文件");
  31. }
  32. else
  33. {
  34. if (!FormHOZMainObject.m_MeasureFile.GetCutHolesFromFile(""))
  35. {
  36. MessageBox.Show("导入切孔失败");
  37. }
  38. else
  39. {
  40. int cutHoleCount = FormHOZMainObject.m_MeasureFile.ListCutHole.Count;
  41. FormHOZMainObject.CreateCutHoleList(cutHoleCount);
  42. }
  43. //this.CutHoleGridView.Rows.Clear();
  44. //List<CutHole> listHoles = m_MeasureFile.ListCutHole;
  45. //foreach (CutHole hole in listHoles)
  46. //{
  47. // //在CutHoleGridView中,添加切孔信息
  48. // int index = this.CutHoleGridView.Rows.Add();
  49. // this.CutHoleGridView.Rows[index].Cells[0].Value = hole.HoleName;
  50. // SemPosition pos = hole.Position;
  51. // this.CutHoleGridView.Rows[index].Cells[1].Value = pos.X;
  52. // this.CutHoleGridView.Rows[index].Cells[2].Value = pos.Y;
  53. // this.CutHoleGridView.Rows[index].Cells[3].Value = pos.Z;
  54. // this.CutHoleGridView.Rows[index].Cells[4].Value = pos.M;
  55. // this.CutHoleGridView.Rows[index].Cells[5].Value = pos.R;
  56. // this.CutHoleGridView.Rows[index].Cells[6].Value = pos.T;
  57. //}
  58. }
  59. }
  60. private void button1_Click(object sender, EventArgs e)
  61. {
  62. if (FormHOZMainObject.m_MeasureFile == null)
  63. {
  64. MessageBox.Show("请新建一个测量文件");
  65. //this.listmsg.Items.Add("请新建一个测量文件");
  66. }
  67. else
  68. {
  69. FormHOZMainObject.m_MeasureFile.MParam.PT = this.cBIsPT.Checked;
  70. FormHOZMainObject.m_MeasureFile.MParam.SampleName = this.tBSampleName.Text;
  71. FormHOZMainObject.m_MeasureFile.MParam.FIBTemp = this.tBFIBTemp.Text;
  72. FormHOZMainObject.m_MeasureFile.MParam.FocusMode = this.cBIsManul.Checked;
  73. MessageBox.Show("参数设置成功");
  74. }
  75. }
  76. private void pbTemplateFile_Click(object sender, EventArgs e)
  77. {
  78. string FilePathName;
  79. string fileNameWithoutExtension;
  80. //新建一个文件对话框
  81. OpenFileDialog pOpenFileDialog = new OpenFileDialog();
  82. //设置对话框标题
  83. pOpenFileDialog.Title = "选择模板文件";
  84. //设置打开文件类型
  85. pOpenFileDialog.Filter = "ely文件(*.ely)|*.ely";
  86. //监测文件是否存在
  87. pOpenFileDialog.CheckFileExists = true;
  88. //文件打开后执行以下程序
  89. if (pOpenFileDialog.ShowDialog() == DialogResult.OK)
  90. {
  91. FilePathName = System.IO.Path.GetFullPath(pOpenFileDialog.FileName); //绝对路径
  92. fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(FilePathName);
  93. this.tBFIBTemp.Text = fileNameWithoutExtension;
  94. }
  95. }
  96. }
  97. }