📄 the main form.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using XOR_ANN.ANN;
namespace XOR_ANN.GUI
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class FormMainForm : System.Windows.Forms.Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
private System.Windows.Forms.Button buttonTrain;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBoxMaxEpochs;
private System.Windows.Forms.TextBox textBoxMomentum;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.TextBox textBoxErrorTolerance;
private System.Windows.Forms.TextBox textBox7;
private System.Windows.Forms.TextBox textBoxLearningRate;
private System.Windows.Forms.Button buttonUpdate;
private System.Windows.Forms.TextBox textBoxHiddenNodes;
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.TextBox textBoxDisplaySample;
private System.Windows.Forms.TextBox textBoxSampleNumber;
private System.Windows.Forms.TextBox textBoxDisplayResult;
private System.Windows.Forms.TextBox textBoxActualResult;
private System.Windows.Forms.TextBox textBoxInputWidth;
private System.Windows.Forms.TextBox textBoxInputHeight;
private System.Windows.Forms.TextBox textBox10;
private System.Windows.Forms.TextBox textBox11;
private System.Windows.Forms.Button buttonLoadSampleData;
private System.Windows.Forms.Button buttonSaveTrainedData;
private System.Windows.Forms.Button buttonVisuallyTestSample;
private System.Windows.Forms.Button buttonLoadTrainedData;
private System.Windows.Forms.Button buttonTestWeightsWithFile;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBoxConvergeTo;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Button buttonResetANNData;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox8;
private System.Windows.Forms.Button buttonEpochDataLogging;
private MainFormLogic nonGUILogic = new MainFormLogic();
public FormMainForm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
this.updateDisplayValues();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <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.textBoxInputHeight = new System.Windows.Forms.TextBox();
this.buttonTestWeightsWithFile = new System.Windows.Forms.Button();
this.textBox11 = new System.Windows.Forms.TextBox();
this.textBox10 = new System.Windows.Forms.TextBox();
this.textBoxInputWidth = new System.Windows.Forms.TextBox();
this.textBoxConvergeTo = new System.Windows.Forms.TextBox();
this.textBoxMaxEpochs = new System.Windows.Forms.TextBox();
this.buttonLoadTrainedData = new System.Windows.Forms.Button();
this.buttonEpochDataLogging = new System.Windows.Forms.Button();
this.buttonSaveTrainedData = new System.Windows.Forms.Button();
this.textBox2 = new System.Windows.Forms.TextBox();
this.buttonResetANNData = new System.Windows.Forms.Button();
this.textBoxDisplayResult = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.buttonLoadSampleData = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox6 = new System.Windows.Forms.TextBox();
this.textBox7 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.textBox5 = new System.Windows.Forms.TextBox();
this.textBox8 = new System.Windows.Forms.TextBox();
this.textBoxDisplaySample = new System.Windows.Forms.TextBox();
this.buttonVisuallyTestSample = new System.Windows.Forms.Button();
this.textBoxErrorTolerance = new System.Windows.Forms.TextBox();
this.textBoxHiddenNodes = new System.Windows.Forms.TextBox();
this.textBoxMomentum = new System.Windows.Forms.TextBox();
this.textBoxActualResult = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.buttonUpdate = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textBoxLearningRate = new System.Windows.Forms.TextBox();
this.textBoxSampleNumber = new System.Windows.Forms.TextBox();
this.buttonTrain = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// textBoxInputHeight
//
this.textBoxInputHeight.Location = new System.Drawing.Point(232, 48);
this.textBoxInputHeight.Name = "textBoxInputHeight";
this.textBoxInputHeight.Size = new System.Drawing.Size(24, 20);
this.textBoxInputHeight.TabIndex = 11;
this.textBoxInputHeight.Text = "";
//
// buttonTestWeightsWithFile
//
this.buttonTestWeightsWithFile.Location = new System.Drawing.Point(8, 304);
this.buttonTestWeightsWithFile.Name = "buttonTestWeightsWithFile";
this.buttonTestWeightsWithFile.Size = new System.Drawing.Size(128, 24);
this.buttonTestWeightsWithFile.TabIndex = 20;
this.buttonTestWeightsWithFile.Text = "Test with a .dat File";
this.buttonTestWeightsWithFile.Click += new System.EventHandler(this.eventHandler_ButtonClick);
//
// textBox11
//
this.textBox11.BackColor = System.Drawing.SystemColors.Control;
this.textBox11.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBox11.Location = new System.Drawing.Point(160, 48);
this.textBox11.Name = "textBox11";
this.textBox11.Size = new System.Drawing.Size(64, 13);
this.textBox11.TabIndex = 0;
this.textBox11.Text = "Input Height:";
//
// textBox10
//
this.textBox10.BackColor = System.Drawing.SystemColors.Control;
this.textBox10.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBox10.Location = new System.Drawing.Point(160, 24);
this.textBox10.Name = "textBox10";
this.textBox10.Size = new System.Drawing.Size(64, 13);
this.textBox10.TabIndex = 0;
this.textBox10.Text = "Input Width:";
//
// textBoxInputWidth
//
this.textBoxInputWidth.Location = new System.Drawing.Point(232, 24);
this.textBoxInputWidth.Name = "textBoxInputWidth";
this.textBoxInputWidth.Size = new System.Drawing.Size(24, 20);
this.textBoxInputWidth.TabIndex = 10;
this.textBoxInputWidth.Text = "";
//
// textBoxConvergeTo
//
this.textBoxConvergeTo.Location = new System.Drawing.Point(96, 152);
this.textBoxConvergeTo.Name = "textBoxConvergeTo";
this.textBoxConvergeTo.Size = new System.Drawing.Size(56, 20);
this.textBoxConvergeTo.TabIndex = 9;
this.textBoxConvergeTo.Text = "";
//
// textBoxMaxEpochs
//
this.textBoxMaxEpochs.Location = new System.Drawing.Point(96, 102);
this.textBoxMaxEpochs.Name = "textBoxMaxEpochs";
this.textBoxMaxEpochs.Size = new System.Drawing.Size(56, 20);
this.textBoxMaxEpochs.TabIndex = 8;
this.textBoxMaxEpochs.Text = "";
//
// buttonLoadTrainedData
//
this.buttonLoadTrainedData.Location = new System.Drawing.Point(168, 240);
this.buttonLoadTrainedData.Name = "buttonLoadTrainedData";
this.buttonLoadTrainedData.Size = new System.Drawing.Size(128, 23);
this.buttonLoadTrainedData.TabIndex = 18;
this.buttonLoadTrainedData.Text = "Load Trained Weights";
this.buttonLoadTrainedData.Click += new System.EventHandler(this.eventHandler_ButtonClick);
//
// buttonEpochDataLogging
//
this.buttonEpochDataLogging.Location = new System.Drawing.Point(8, 368);
this.buttonEpochDataLogging.Name = "buttonEpochDataLogging";
this.buttonEpochDataLogging.Size = new System.Drawing.Size(128, 23);
this.buttonEpochDataLogging.TabIndex = 23;
this.buttonEpochDataLogging.Text = "Epoch Data Logging";
this.buttonEpochDataLogging.Click += new System.EventHandler(this.eventHandler_ButtonClick);
//
// buttonSaveTrainedData
//
this.buttonSaveTrainedData.Location = new System.Drawing.Point(168, 272);
this.buttonSaveTrainedData.Name = "buttonSaveTrainedData";
this.buttonSaveTrainedData.Size = new System.Drawing.Size(128, 23);
this.buttonSaveTrainedData.TabIndex = 17;
this.buttonSaveTrainedData.Text = "Save Trained Weights";
this.buttonSaveTrainedData.Click += new System.EventHandler(this.eventHandler_ButtonClick);
//
// textBox2
//
this.textBox2.BackColor = System.Drawing.SystemColors.Control;
this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBox2.Location = new System.Drawing.Point(16, 102);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(80, 13);
this.textBox2.TabIndex = 0;
this.textBox2.Text = "Max Epochs:";
//
// buttonResetANNData
//
this.buttonResetANNData.Location = new System.Drawing.Point(8, 336);
this.buttonResetANNData.Name = "buttonResetANNData";
this.buttonResetANNData.Size = new System.Drawing.Size(128, 23);
this.buttonResetANNData.TabIndex = 19;
this.buttonResetANNData.Text = "Reset ANN Data";
this.buttonResetANNData.Click += new System.EventHandler(this.eventHandler_ButtonClick);
//
// textBoxDisplayResult
//
this.textBoxDisplayResult.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.textBoxDisplayResult.Location = new System.Drawing.Point(312, 336);
this.textBoxDisplayResult.Name = "textBoxDisplayResult";
this.textBoxDisplayResult.Size = new System.Drawing.Size(264, 20);
this.textBoxDisplayResult.TabIndex = 15;
this.textBoxDisplayResult.Text = "";
//
// textBox3
//
this.textBox3.BackColor = System.Drawing.SystemColors.Control;
this.textBox3.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBox3.Location = new System.Drawing.Point(16, 152);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(72, 13);
this.textBox3.TabIndex = 0;
this.textBox3.Text = "Converge To:";
//
// buttonLoadSampleData
//
this.buttonLoadSampleData.Location = new System.Drawing.Point(8, 240);
this.buttonLoadSampleData.Name = "buttonLoadSampleData";
this.buttonLoadSampleData.Size = new System.Drawing.Size(128, 23);
this.buttonLoadSampleData.TabIndex = 11;
this.buttonLoadSampleData.Text = "Load .dat File";
this.buttonLoadSampleData.Click += new System.EventHandler(this.eventHandler_ButtonClick);
//
// textBox1
//
this.textBox1.BackColor = System.Drawing.SystemColors.Control;
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBox1.Location = new System.Drawing.Point(208, 344);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 22;
this.textBox1.Text = "Expected Output:";
this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// textBox6
//
this.textBox6.BackColor = System.Drawing.SystemColors.Control;
this.textBox6.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBox6.Location = new System.Drawing.Point(16, 128);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(80, 13);
this.textBox6.TabIndex = 0;
this.textBox6.Text = "Hidden Nodes:";
//
// textBox7
//
this.textBox7.BackColor = System.Drawing.SystemColors.Control;
this.textBox7.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBox7.Location = new System.Drawing.Point(16, 24);
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(80, 13);
this.textBox7.TabIndex = 0;
this.textBox7.Text = "Learning Rate:";
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -