This commit is contained in:
GukSang.Jin
2025-12-31 17:26:27 +08:00
parent 93e040e7ae
commit 3ae2dd63a2
3 changed files with 657 additions and 121 deletions

View File

@@ -1,19 +1,12 @@
using System.Drawing;
// 若用到渐变/高级绘图,补充以下命名空间(可选)
using System.Drawing.Drawing2D;
namespace WindowsFormsApp6
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@@ -25,118 +18,448 @@ namespace WindowsFormsApp6
#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.panel1 = new System.Windows.Forms.Panel();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.panelTop = new System.Windows.Forms.Panel();
this.label2 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.Main = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.panelTitle = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.panelInfo = new System.Windows.Forms.Panel();
this.textBox6 = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.textBox5 = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.textBox4 = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.panelBottom = new System.Windows.Forms.Panel();
this.button5 = new System.Windows.Forms.Button();
this.buttonExport = new System.Windows.Forms.Button();
this.buttonPrint = new System.Windows.Forms.Button();
this.tableLayoutPanel1.SuspendLayout();
this.panelTop.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.panelTitle.SuspendLayout();
this.panelInfo.SuspendLayout();
this.tabControl1.SuspendLayout();
this.panelBottom.SuspendLayout();
this.SuspendLayout();
//
// panel1
// tableLayoutPanel1
//
this.panel1.BackColor = System.Drawing.Color.White;
this.panel1.Controls.Add(this.button3);
this.panel1.Controls.Add(this.button2);
this.panel1.Controls.Add(this.button1);
this.panel1.Controls.Add(this.Main);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1178, 844);
this.panel1.TabIndex = 0;
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.panelTop, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.tabControl1, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.panelBottom, 0, 3);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 4;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 80F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 120F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 80F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1200, 800);
this.tableLayoutPanel1.TabIndex = 0;
//
// button3
// panelTop
//
this.button3.Anchor = System.Windows.Forms.AnchorStyles.None;
this.button3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(89)))), ((int)(((byte)(182)))));
this.button3.FlatAppearance.BorderSize = 0;
this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button3.ForeColor = System.Drawing.Color.White;
this.button3.Location = new System.Drawing.Point(710, 400);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(240, 100);
this.button3.TabIndex = 3;
this.button3.Text = "📈 液体芯吸速率";
this.button3.UseVisualStyleBackColor = false;
this.button3.Click += new System.EventHandler(this.button3_Click);
this.panelTop.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(52)))), ((int)(((byte)(152)))), ((int)(((byte)(219)))));
this.panelTop.Controls.Add(this.label2);
this.panelTop.Controls.Add(this.button1);
this.panelTop.Controls.Add(this.comboBox1);
this.panelTop.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelTop.Location = new System.Drawing.Point(3, 3);
this.panelTop.Name = "panelTop";
this.panelTop.Padding = new System.Windows.Forms.Padding(20, 15, 20, 15);
this.panelTop.Size = new System.Drawing.Size(1194, 74);
this.panelTop.TabIndex = 0;
//
// button2
// label2
//
this.button2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(196)))), ((int)(((byte)(15)))));
this.button2.FlatAppearance.BorderSize = 0;
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button2.ForeColor = System.Drawing.Color.White;
this.button2.Location = new System.Drawing.Point(454, 400);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(240, 100);
this.button2.TabIndex = 2;
this.button2.Text = "💧 液体吸收量";
this.button2.UseVisualStyleBackColor = false;
this.button2.Click += new System.EventHandler(this.button2_Click);
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("微软雅黑", 10F);
this.label2.ForeColor = System.Drawing.Color.White;
this.label2.Location = new System.Drawing.Point(950, 27);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(78, 23);
this.label2.TabIndex = 3;
this.label2.Text = "日期时间";
//
// button1
//
this.button1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(52)))), ((int)(((byte)(152)))), ((int)(((byte)(219)))));
this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(46)))), ((int)(((byte)(204)))), ((int)(((byte)(113)))));
this.button1.FlatAppearance.BorderSize = 0;
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold);
this.button1.ForeColor = System.Drawing.Color.White;
this.button1.Location = new System.Drawing.Point(198, 400);
this.button1.Location = new System.Drawing.Point(189, 18);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(240, 100);
this.button1.TabIndex = 1;
this.button1.Text = "⏱️ 液体吸收时间";
this.button1.Size = new System.Drawing.Size(140, 38);
this.button1.TabIndex = 2;
this.button1.Text = "🔗 连接设备";
this.button1.UseVisualStyleBackColor = false;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Main
// comboBox1
//
this.Main.Anchor = System.Windows.Forms.AnchorStyles.None;
this.Main.AutoSize = true;
this.Main.Font = new System.Drawing.Font("微软雅黑", 28F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Main.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(52)))), ((int)(((byte)(73)))), ((int)(((byte)(94)))));
this.Main.Location = new System.Drawing.Point(198, 200);
this.Main.Name = "Main";
this.Main.Size = new System.Drawing.Size(685, 62);
this.Main.TabIndex = 0;
this.Main.Text = "非织造布液体吸收性能测试报告\r\n";
this.Main.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.comboBox1.BackColor = System.Drawing.Color.White;
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.comboBox1.Font = new System.Drawing.Font("微软雅黑", 9F);
this.comboBox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(52)))), ((int)(((byte)(73)))), ((int)(((byte)(94)))));
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(19, 23);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(160, 28);
this.comboBox1.TabIndex = 1;
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 1;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Controls.Add(this.panelTitle, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.panelInfo, 0, 1);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 83);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 2;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 36F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(1194, 114);
this.tableLayoutPanel2.TabIndex = 1;
//
// panelTitle
//
this.panelTitle.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(248)))), ((int)(((byte)(255)))));
this.panelTitle.Controls.Add(this.label1);
this.panelTitle.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelTitle.Location = new System.Drawing.Point(3, 3);
this.panelTitle.Name = "panelTitle";
this.panelTitle.Size = new System.Drawing.Size(1188, 30);
this.panelTitle.TabIndex = 0;
//
// label1
//
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold);
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(52)))), ((int)(((byte)(152)))), ((int)(((byte)(219)))));
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(1188, 30);
this.label1.TabIndex = 0;
this.label1.Text = "📄 液体吸收测试报告";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panelInfo
//
this.panelInfo.BackColor = System.Drawing.Color.White;
this.panelInfo.Controls.Add(this.textBox6);
this.panelInfo.Controls.Add(this.label8);
this.panelInfo.Controls.Add(this.textBox5);
this.panelInfo.Controls.Add(this.label7);
this.panelInfo.Controls.Add(this.textBox4);
this.panelInfo.Controls.Add(this.label6);
this.panelInfo.Controls.Add(this.textBox3);
this.panelInfo.Controls.Add(this.label5);
this.panelInfo.Controls.Add(this.textBox2);
this.panelInfo.Controls.Add(this.label4);
this.panelInfo.Controls.Add(this.textBox1);
this.panelInfo.Controls.Add(this.label3);
this.panelInfo.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelInfo.Location = new System.Drawing.Point(3, 39);
this.panelInfo.Name = "panelInfo";
this.panelInfo.Padding = new System.Windows.Forms.Padding(20, 10, 20, 10);
this.panelInfo.Size = new System.Drawing.Size(1188, 72);
this.panelInfo.TabIndex = 1;
//
// textBox6
//
this.textBox6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox6.Font = new System.Drawing.Font("微软雅黑", 9F);
this.textBox6.Location = new System.Drawing.Point(532, 43);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(140, 27);
this.textBox6.TabIndex = 11;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Font = new System.Drawing.Font("微软雅黑", 9F);
this.label8.Location = new System.Drawing.Point(453, 46);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(73, 20);
this.label8.TabIndex = 10;
this.label8.Text = "设备编号:";
//
// textBox5
//
this.textBox5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox5.Font = new System.Drawing.Font("微软雅黑", 9F);
this.textBox5.Location = new System.Drawing.Point(278, 43);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(140, 27);
this.textBox5.TabIndex = 9;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("微软雅黑", 9F);
this.label7.Location = new System.Drawing.Point(229, 46);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(43, 20);
this.label7.TabIndex = 8;
this.label7.Text = "仪器:";
//
// textBox4
//
this.textBox4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox4.Font = new System.Drawing.Font("微软雅黑", 9F);
this.textBox4.Location = new System.Drawing.Point(795, 43);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(140, 27);
this.textBox4.TabIndex = 7;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("微软雅黑", 9F);
this.label6.Location = new System.Drawing.Point(716, 46);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(73, 20);
this.label6.TabIndex = 6;
this.label6.Text = "操作人员:";
//
// textBox3
//
this.textBox3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox3.Font = new System.Drawing.Font("微软雅黑", 9F);
this.textBox3.Location = new System.Drawing.Point(795, 9);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(140, 27);
this.textBox3.TabIndex = 5;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("微软雅黑", 9F);
this.label5.Location = new System.Drawing.Point(746, 12);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(43, 20);
this.label5.TabIndex = 4;
this.label5.Text = "批号:";
//
// textBox2
//
this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox2.Font = new System.Drawing.Font("微软雅黑", 9F);
this.textBox2.Location = new System.Drawing.Point(532, 9);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(140, 27);
this.textBox2.TabIndex = 3;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("微软雅黑", 9F);
this.label4.Location = new System.Drawing.Point(453, 12);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(73, 20);
this.label4.TabIndex = 2;
this.label4.Text = "物料编码:";
//
// textBox1
//
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox1.Font = new System.Drawing.Font("微软雅黑", 9F);
this.textBox1.Location = new System.Drawing.Point(278, 9);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(140, 27);
this.textBox1.TabIndex = 1;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("微软雅黑", 9F);
this.label3.Location = new System.Drawing.Point(199, 12);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(73, 20);
this.label3.TabIndex = 0;
this.label3.Text = "样品名称:";
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Bold);
this.tabControl1.Location = new System.Drawing.Point(3, 203);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1194, 514);
this.tabControl1.TabIndex = 2;
//
// tabPage1
//
this.tabPage1.Location = new System.Drawing.Point(4, 32);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(1186, 478);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "⏱️ 液体吸收时间";
this.tabPage1.UseVisualStyleBackColor = true;
//
// tabPage2
//
this.tabPage2.Location = new System.Drawing.Point(4, 32);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(1186, 478);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "💧 液体吸收量";
this.tabPage2.UseVisualStyleBackColor = true;
//
// tabPage3
//
this.tabPage3.Location = new System.Drawing.Point(4, 32);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(1186, 478);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "📈 液体芯吸速率";
this.tabPage3.UseVisualStyleBackColor = true;
//
// panelBottom
//
this.panelBottom.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(245)))), ((int)(((byte)(245)))));
this.panelBottom.Controls.Add(this.button5);
this.panelBottom.Controls.Add(this.buttonExport);
this.panelBottom.Controls.Add(this.buttonPrint);
this.panelBottom.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelBottom.Location = new System.Drawing.Point(3, 723);
this.panelBottom.Name = "panelBottom";
this.panelBottom.Padding = new System.Windows.Forms.Padding(20, 10, 20, 10);
this.panelBottom.Size = new System.Drawing.Size(1194, 74);
this.panelBottom.TabIndex = 3;
//
// button5
//
this.button5.Anchor = System.Windows.Forms.AnchorStyles.None;
this.button5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(89)))), ((int)(((byte)(182)))));
this.button5.FlatAppearance.BorderSize = 0;
this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button5.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Bold);
this.button5.ForeColor = System.Drawing.Color.White;
this.button5.Location = new System.Drawing.Point(357, 17);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(140, 40);
this.button5.TabIndex = 3;
this.button5.Text = "🎲 模拟数据";
this.button5.UseVisualStyleBackColor = false;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// buttonExport
//
this.buttonExport.Anchor = System.Windows.Forms.AnchorStyles.None;
this.buttonExport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(196)))), ((int)(((byte)(15)))));
this.buttonExport.FlatAppearance.BorderSize = 0;
this.buttonExport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonExport.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Bold);
this.buttonExport.ForeColor = System.Drawing.Color.White;
this.buttonExport.Location = new System.Drawing.Point(677, 17);
this.buttonExport.Name = "buttonExport";
this.buttonExport.Size = new System.Drawing.Size(140, 40);
this.buttonExport.TabIndex = 1;
this.buttonExport.Text = "📤 导出";
this.buttonExport.UseVisualStyleBackColor = false;
this.buttonExport.Click += new System.EventHandler(this.buttonExport_Click);
//
// buttonPrint
//
this.buttonPrint.Anchor = System.Windows.Forms.AnchorStyles.None;
this.buttonPrint.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(52)))), ((int)(((byte)(152)))), ((int)(((byte)(219)))));
this.buttonPrint.FlatAppearance.BorderSize = 0;
this.buttonPrint.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonPrint.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Bold);
this.buttonPrint.ForeColor = System.Drawing.Color.White;
this.buttonPrint.Location = new System.Drawing.Point(517, 17);
this.buttonPrint.Name = "buttonPrint";
this.buttonPrint.Size = new System.Drawing.Size(140, 40);
this.buttonPrint.TabIndex = 0;
this.buttonPrint.Text = "🖨️ 打印";
this.buttonPrint.UseVisualStyleBackColor = false;
this.buttonPrint.Click += new System.EventHandler(this.buttonPrint_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 19F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(1178, 844);
this.Controls.Add(this.panel1);
this.ClientSize = new System.Drawing.Size(1200, 800);
this.Controls.Add(this.tableLayoutPanel1);
this.Font = new System.Drawing.Font("微软雅黑", 8F);
this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "非织造布液体吸收性能测试系统";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.tableLayoutPanel1.ResumeLayout(false);
this.panelTop.ResumeLayout(false);
this.panelTop.PerformLayout();
this.tableLayoutPanel2.ResumeLayout(false);
this.panelTitle.ResumeLayout(false);
this.panelInfo.ResumeLayout(false);
this.panelInfo.PerformLayout();
this.tabControl1.ResumeLayout(false);
this.panelBottom.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Panel panelTop;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label Main;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.Panel panelTitle;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel panelInfo;
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.Panel panelBottom;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button buttonExport;
private System.Windows.Forms.Button buttonPrint;
}
}
}

View File

@@ -1,68 +1,168 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using NPOI.SS.Util;
using NPOIBorderStyle = NPOI.SS.UserModel.BorderStyle;
using NPOIHorizontalAlignment = NPOI.SS.UserModel.HorizontalAlignment;
namespace WindowsFormsApp6
{
public partial class MainForm : Form
{
{
private Form1 form1Instance;
private Form2 form2Instance;
private Form3 form3Instance;
private System.Windows.Forms.Timer clockTimer;
public MainForm()
{
InitializeComponent();
InitializeClockTimer();
InitializeTabControl();
InitializeEmbeddedForms();
}
//private void SwitchToForm<T>() where T : Form, new()
//{
// T form = new T();
// // 处理窗体关闭事件
// form.FormClosed += (s, args) =>
// {
// this.Show(); // 显示主窗体
// this.Activate(); // 激活主窗体
// };
// form.Show();
// this.Hide();
//}
private void SwitchToForm<T>() where T : Form, new()
private void InitializeClockTimer()
{
using (T form = new T())
clockTimer = new System.Windows.Forms.Timer();
clockTimer.Interval = 1000;
clockTimer.Tick += (s, e) => label2.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
clockTimer.Start();
}
private void InitializeTabControl()
{
tabControl1.SelectedIndexChanged += TabControl1_SelectedIndexChanged;
}
private void TabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
UpdateTitleForCurrentTab();
}
private void UpdateTitleForCurrentTab()
{
switch (tabControl1.SelectedIndex)
{
this.Hide();
form.ShowDialog();
this.Show();
this.Activate();
case 0:
label1.Text = " 液体吸收时间测试报告";
break;
case 1:
label1.Text = " 液体吸收量测试报告";
break;
case 2:
label1.Text = " 液体芯吸速率测试报告";
break;
}
}
private void button1_Click(object sender, EventArgs e)
private void InitializeEmbeddedForms()
{
this.SwitchToForm<Form1>();
form1Instance = new Form1();
form1Instance.TopLevel = false;
form1Instance.FormBorderStyle = FormBorderStyle.None;
form1Instance.Dock = DockStyle.Fill;
Panel panel1 = new Panel();
panel1.Dock = DockStyle.Fill;
panel1.Controls.Add(form1Instance.Controls["tableLayoutPanel1"].Controls["panel3"]);
tabPage1.Controls.Add(panel1);
form1Instance.Show();
form2Instance = new Form2();
form2Instance.TopLevel = false;
form2Instance.FormBorderStyle = FormBorderStyle.None;
form2Instance.Dock = DockStyle.Fill;
Panel panel2 = new Panel();
panel2.Dock = DockStyle.Fill;
panel2.Controls.Add(form2Instance.Controls["tableLayoutPanel1"].Controls["panel3"]);
tabPage2.Controls.Add(panel2);
form2Instance.Show();
form3Instance = new Form3();
form3Instance.TopLevel = false;
form3Instance.FormBorderStyle = FormBorderStyle.None;
form3Instance.Dock = DockStyle.Fill;
Panel panel3 = new Panel();
panel3.Dock = DockStyle.Fill;
panel3.Controls.Add(form3Instance.Controls["tableLayoutPanel1"].Controls["panel3"]);
tabPage3.Controls.Add(panel3);
form3Instance.Show();
}
private void button2_Click(object sender, EventArgs e)
private void buttonPrint_Click(object sender, EventArgs e)
{
this.SwitchToForm<Form2>();
MessageBox.Show("打印功能开发中", "提示");
}
private void buttonExport_Click(object sender, EventArgs e)
{
SaveFileDialog saveFileDialog = new SaveFileDialog
{
Filter = "Excel 文件 (*.xlsx)|*.xlsx",
FileName = $"测试报告_{DateTime.Now:yyyyMMdd_HHmmss}",
Title = "导出整合报告"
};
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
ExportIntegratedReport(saveFileDialog.FileName);
}
}
private void button5_Click(object sender, EventArgs e)
{
switch (tabControl1.SelectedIndex)
{
case 0:
form1Instance.GenerateMockData();
break;
case 1:
form2Instance.GenerateMockData();
break;
case 2:
form3Instance.GenerateMockData();
break;
}
}
private void ExportIntegratedReport(string filePath)
{
try
{
IWorkbook workbook = new XSSFWorkbook();
CreateForm1Sheet(workbook);
CreateForm2Sheet(workbook);
CreateForm3Sheet(workbook);
using (FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write))
{
workbook.Write(fs);
}
MessageBox.Show($"导出成功:{filePath}", "成功");
}
catch (Exception ex)
{
MessageBox.Show($"导出失败:{ex.Message}", "错误");
}
}
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
// 退出应用程序
clockTimer?.Stop();
clockTimer?.Dispose();
Application.Exit();
}
private void button3_Click(object sender, EventArgs e)
{
this.SwitchToForm<Form3>();
}
private void CreateForm1Sheet(IWorkbook workbook) { }
private void CreateForm2Sheet(IWorkbook workbook) { }
private void CreateForm3Sheet(IWorkbook workbook) { }
}
}

View File

@@ -0,0 +1,113 @@
using System;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using NPOI.SS.Util;
using NPOIBorderStyle = NPOI.SS.UserModel.BorderStyle;
using NPOIHorizontalAlignment = NPOI.SS.UserModel.HorizontalAlignment;
namespace WindowsFormsApp6
{
public partial class MainForm : Form
{
private Form1 form1Instance;
private Form2 form2Instance;
private Form3 form3Instance;
public MainForm()
{
InitializeComponent();
InitializeTabControl();
InitializeEmbeddedForms();
}
private void InitializeTabControl()
{
tabControl1.SelectedIndexChanged += TabControl1_SelectedIndexChanged;
}
private void TabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void InitializeEmbeddedForms()
{
form1Instance = new Form1();
form1Instance.TopLevel = false;
form1Instance.FormBorderStyle = FormBorderStyle.None;
form1Instance.Dock = DockStyle.Fill;
tabPage1.Controls.Add(form1Instance);
form1Instance.Show();
form2Instance = new Form2();
form2Instance.TopLevel = false;
form2Instance.FormBorderStyle = FormBorderStyle.None;
form2Instance.Dock = DockStyle.Fill;
tabPage2.Controls.Add(form2Instance);
form2Instance.Show();
form3Instance = new Form3();
form3Instance.TopLevel = false;
form3Instance.FormBorderStyle = FormBorderStyle.None;
form3Instance.Dock = DockStyle.Fill;
tabPage3.Controls.Add(form3Instance);
form3Instance.Show();
}
private void buttonPrint_Click(object sender, EventArgs e)
{
MessageBox.Show("打印功能开发中", "提示");
}
private void buttonExport_Click(object sender, EventArgs e)
{
SaveFileDialog saveFileDialog = new SaveFileDialog
{
Filter = "Excel 文件 (*.xlsx)|*.xlsx",
FileName = $"测试报告_{DateTime.Now:yyyyMMdd_HHmmss}",
Title = "导出整合报告"
};
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
ExportIntegratedReport(saveFileDialog.FileName);
}
}
private void ExportIntegratedReport(string filePath)
{
try
{
IWorkbook workbook = new XSSFWorkbook();
CreateForm1Sheet(workbook);
CreateForm2Sheet(workbook);
CreateForm3Sheet(workbook);
using (FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write))
{
workbook.Write(fs);
}
MessageBox.Show($"导出成功:{filePath}", "成功");
}
catch (Exception ex)
{
MessageBox.Show($"导出失败:{ex.Message}", "错误");
}
}
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
Application.Exit();
}
private void CreateForm1Sheet(IWorkbook workbook) { }
private void CreateForm2Sheet(IWorkbook workbook) { }
private void CreateForm3Sheet(IWorkbook workbook) { }
private (ICellStyle, ICellStyle, ICellStyle, ICellStyle) CreateReportStyles(IWorkbook workbook) { return (null, null, null, null); }
private void SetBorders(ICellStyle style) { }
}
}