SpectrumExportConfirmation.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. //保存对话框是否记忆上次打开的目录
  50. sfd.RestoreDirectory = true;
  51. if (sfd.ShowDialog() == DialogResult.OK)
  52. {
  53. tBox1.Text = sfd.FileName;
  54. }
  55. }
  56. private void cB_SpectrumConfirmation_CheckedChanged(object sender, EventArgs e)
  57. {
  58. if(cB_SpectrumConfirmation.Checked)
  59. {
  60. m_SpectrumConfirmation = true;
  61. }
  62. else
  63. {
  64. m_SpectrumConfirmation = false;
  65. }
  66. }
  67. private void bt_Export_Click(object sender, EventArgs e)
  68. {
  69. if(tBox1.Text == "")
  70. {
  71. MessageBox.Show("save path can not be null!");
  72. }
  73. else
  74. {
  75. m_savepath = tBox1.Text;
  76. this.DialogResult = DialogResult.OK;
  77. this.Close();
  78. }
  79. }
  80. }
  81. }