SpectrumExportConfirmation.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace OTSIncAReportApp._1_UI.Control_Grids
  11. {
  12. public partial class SpectrumExportConfirmation : Form
  13. {
  14. bool m_SpectrumConfirmation = false;
  15. string m_savepath = "";
  16. public bool SpectrumConfirmation
  17. {
  18. get
  19. {
  20. return m_SpectrumConfirmation;
  21. }
  22. set
  23. {
  24. m_SpectrumConfirmation = value;
  25. }
  26. }
  27. public string FileName
  28. {
  29. get
  30. {
  31. return m_savepath;
  32. }
  33. set
  34. {
  35. m_savepath = value;
  36. }
  37. }
  38. public SpectrumExportConfirmation()
  39. {
  40. InitializeComponent();
  41. }
  42. private void bt_Path_Click(object sender, EventArgs e)
  43. {
  44. //将所有的数据导出到EXCEL中
  45. SaveFileDialog sfd = new SaveFileDialog();
  46. sfd.Filter = "Excel File(*.xlsx)|*.xlsx";
  47. //设置默认文件类型显示顺序
  48. sfd.FilterIndex = 1;
  49. sfd.FileName = "ParticlesInfo";
  50. //保存对话框是否记忆上次打开的目录
  51. sfd.RestoreDirectory = true;
  52. if (sfd.ShowDialog() == DialogResult.OK)
  53. {
  54. tBox1.Text = sfd.FileName;
  55. }
  56. }
  57. private void cB_SpectrumConfirmation_CheckedChanged(object sender, EventArgs e)
  58. {
  59. if(cB_SpectrumConfirmation.Checked)
  60. {
  61. m_SpectrumConfirmation = true;
  62. }
  63. else
  64. {
  65. m_SpectrumConfirmation = false;
  66. }
  67. }
  68. private void bt_Export_Click(object sender, EventArgs e)
  69. {
  70. if(tBox1.Text == "")
  71. {
  72. MessageBox.Show("save path can not be null!");
  73. }
  74. else
  75. {
  76. m_savepath = tBox1.Text;
  77. this.DialogResult = DialogResult.OK;
  78. this.Close();
  79. }
  80. }
  81. }
  82. }