📄 saveform.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace Cluster_Validations
{
/// <summary>
/// Summary description for SaveForm.
/// </summary>
public class SaveForm : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBoxGDISaveFile;
private System.Windows.Forms.Button buttonGDISaveFile;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.SaveFileDialog saveFileDialog;
private System.Windows.Forms.Button buttonDBISaveFile;
private System.Windows.Forms.Button buttonSDISaveFile;
private System.Windows.Forms.TextBox textBoxDBISaveFile;
private System.Windows.Forms.TextBox textBoxSDISaveFile;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
private MainForm m_MainForm;
private System.Windows.Forms.ProgressBar m_progressbar;
private string m_SaveFileName;
public SaveForm(MainForm mainForm, string saveFileName, bool bGDI, bool bDBI, bool bSDI)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
this.m_MainForm = mainForm;
this.m_SaveFileName = saveFileName;
if ( bGDI == true ) {
this.textBoxGDISaveFile.Text = saveFileName + "_GDI_Result.xls";
this.buttonGDISaveFile.Enabled = true;
this.textBoxGDISaveFile.Enabled = true;
this.m_progressbar.Maximum = this.m_progressbar.Maximum + 4;
}
if ( bDBI == true ) {
this.textBoxDBISaveFile.Text = saveFileName + "_DBI_Result.xls" ;
this.buttonDBISaveFile.Enabled = true;
this.textBoxDBISaveFile.Enabled = true;
this.m_progressbar.Maximum = this.m_progressbar.Maximum + 4;
}
if ( bSDI == true ) {
this.textBoxSDISaveFile.Text = saveFileName + "_SDI_Result.xls" ;
this.buttonSDISaveFile.Enabled = true;
this.textBoxSDISaveFile.Enabled = true;
this.m_progressbar.Maximum = this.m_progressbar.Maximum + 4;
}
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.textBoxGDISaveFile = new System.Windows.Forms.TextBox();
this.buttonGDISaveFile = new System.Windows.Forms.Button();
this.buttonDBISaveFile = new System.Windows.Forms.Button();
this.buttonSDISaveFile = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.textBoxDBISaveFile = new System.Windows.Forms.TextBox();
this.textBoxSDISaveFile = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.buttonOK = new System.Windows.Forms.Button();
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
this.m_progressbar = new System.Windows.Forms.ProgressBar();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// textBoxGDISaveFile
//
this.textBoxGDISaveFile.Enabled = false;
this.textBoxGDISaveFile.Location = new System.Drawing.Point(56, 32);
this.textBoxGDISaveFile.Name = "textBoxGDISaveFile";
this.textBoxGDISaveFile.Size = new System.Drawing.Size(184, 21);
this.textBoxGDISaveFile.TabIndex = 10;
this.textBoxGDISaveFile.Text = "";
//
// buttonGDISaveFile
//
this.buttonGDISaveFile.Enabled = false;
this.buttonGDISaveFile.Location = new System.Drawing.Point(248, 32);
this.buttonGDISaveFile.Name = "buttonGDISaveFile";
this.buttonGDISaveFile.Size = new System.Drawing.Size(40, 23);
this.buttonGDISaveFile.TabIndex = 1;
this.buttonGDISaveFile.Text = "...";
this.buttonGDISaveFile.Click += new System.EventHandler(this.buttonGDISaveFile_Click);
//
// buttonDBISaveFile
//
this.buttonDBISaveFile.Enabled = false;
this.buttonDBISaveFile.Location = new System.Drawing.Point(248, 64);
this.buttonDBISaveFile.Name = "buttonDBISaveFile";
this.buttonDBISaveFile.Size = new System.Drawing.Size(40, 23);
this.buttonDBISaveFile.TabIndex = 2;
this.buttonDBISaveFile.Text = "...";
this.buttonDBISaveFile.Click += new System.EventHandler(this.buttonDBISaveFile_Click);
//
// buttonSDISaveFile
//
this.buttonSDISaveFile.Enabled = false;
this.buttonSDISaveFile.Location = new System.Drawing.Point(248, 96);
this.buttonSDISaveFile.Name = "buttonSDISaveFile";
this.buttonSDISaveFile.Size = new System.Drawing.Size(40, 23);
this.buttonSDISaveFile.TabIndex = 3;
this.buttonSDISaveFile.Text = "...";
this.buttonSDISaveFile.Click += new System.EventHandler(this.buttonSDISaveFile_Click);
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 32);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(40, 24);
this.label1.TabIndex = 4;
this.label1.Text = "GDI : ";
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 96);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(40, 24);
this.label2.TabIndex = 5;
this.label2.Text = "SDI : ";
//
// label3
//
this.label3.Location = new System.Drawing.Point(8, 64);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(40, 24);
this.label3.TabIndex = 6;
this.label3.Text = "DBI : ";
//
// textBoxDBISaveFile
//
this.textBoxDBISaveFile.Enabled = false;
this.textBoxDBISaveFile.Location = new System.Drawing.Point(56, 64);
this.textBoxDBISaveFile.Name = "textBoxDBISaveFile";
this.textBoxDBISaveFile.Size = new System.Drawing.Size(184, 21);
this.textBoxDBISaveFile.TabIndex = 7;
this.textBoxDBISaveFile.Text = "";
//
// textBoxSDISaveFile
//
this.textBoxSDISaveFile.Enabled = false;
this.textBoxSDISaveFile.Location = new System.Drawing.Point(56, 96);
this.textBoxSDISaveFile.Name = "textBoxSDISaveFile";
this.textBoxSDISaveFile.Size = new System.Drawing.Size(184, 21);
this.textBoxSDISaveFile.TabIndex = 8;
this.textBoxSDISaveFile.Text = "";
//
// groupBox1
//
this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
this.buttonGDISaveFile,
this.label1,
this.textBoxDBISaveFile,
this.label3,
this.buttonDBISaveFile,
this.buttonSDISaveFile,
this.label2,
this.textBoxSDISaveFile,
this.textBoxGDISaveFile});
this.groupBox1.Location = new System.Drawing.Point(8, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(296, 136);
this.groupBox1.TabIndex = 9;
this.groupBox1.TabStop = false;
//
// buttonOK
//
this.buttonOK.Location = new System.Drawing.Point(312, 8);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(64, 152);
this.buttonOK.TabIndex = 0;
this.buttonOK.Text = "Save";
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// saveFileDialog
//
this.saveFileDialog.Filter = "*.xls | *.xls";
//
// m_progressbar
//
this.m_progressbar.Location = new System.Drawing.Point(8, 144);
this.m_progressbar.Maximum = 4;
this.m_progressbar.Name = "m_progressbar";
this.m_progressbar.Size = new System.Drawing.Size(296, 16);
this.m_progressbar.Step = 1;
this.m_progressbar.TabIndex = 0;
//
// SaveForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(384, 165);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.m_progressbar,
this.buttonOK,
this.groupBox1});
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SaveForm";
this.Text = "SaveForm";
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void buttonGDISaveFile_Click(object sender, System.EventArgs e) {
this.saveFileDialog.FileName = this.textBoxGDISaveFile.Text;
if ( this.saveFileDialog.ShowDialog() == DialogResult.OK ){
this.textBoxGDISaveFile.Text = this.saveFileDialog.FileName;
}
}
private void buttonDBISaveFile_Click(object sender, System.EventArgs e) {
this.saveFileDialog.FileName = this.textBoxDBISaveFile.Text;
if ( this.saveFileDialog.ShowDialog() == DialogResult.OK ){
this.textBoxDBISaveFile.Text = this.saveFileDialog.FileName;
}
}
private void buttonSDISaveFile_Click(object sender, System.EventArgs e) {
this.saveFileDialog.FileName = this.textBoxSDISaveFile.Text;
if ( this.saveFileDialog.ShowDialog() == DialogResult.OK ) {
this.textBoxSDISaveFile.Text = this.saveFileDialog.FileName;
}
}
private void buttonOK_Click(object sender, System.EventArgs e) {
this.m_MainForm.SaveFiles( this.textBoxGDISaveFile.Text, this.textBoxDBISaveFile.Text, this.textBoxSDISaveFile.Text, this.m_progressbar );
this.Dispose();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -