📄 winhrd.cs
字号:
using System;
using System.Text;
using System.Drawing;
using System.Threading;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using HRD.Core;
using HRD.AVL;
using HRD.CircularList;
using HRD.TreeList;
namespace WinHRD
{
public class frmMain : System.Windows.Forms.Form, IResultHandler
{
private System.Windows.Forms.TextBox txtResult;
private System.Windows.Forms.Button btnBegin;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.ImageList imgList;
private System.Windows.Forms.RadioButton optLayout1;
private System.Windows.Forms.RadioButton optLayout2;
private System.Windows.Forms.RadioButton optLayout3;
private System.Windows.Forms.RadioButton optLayout4;
private System.Windows.Forms.RadioButton optLayout5;
private System.Windows.Forms.RadioButton optLayout6;
private System.Windows.Forms.RadioButton optLayout7;
private System.Windows.Forms.RadioButton optLayout8;
private System.Windows.Forms.RadioButton optLayout10;
private System.Windows.Forms.RadioButton optLayout9;
private System.ComponentModel.IContainer components;
private System.Windows.Forms.Label lblInfo;
private System.Windows.Forms.NumericUpDown nupLayoutsPerLine;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private ILayoutFactory layoutFactory = new LayoutFactory1();
private Mediator mediator;
private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.StatusBarPanel statusBarPanel1;
private System.Windows.Forms.StatusBarPanel statusBarPanel2;
private System.Windows.Forms.StatusBar stbInfo;
private System.Windows.Forms.StatusBarPanel statusBarPanel3;
public frmMain()
{
InitializeComponent();
// 初始化自动求解程序
mediator = new Mediator();
mediator.avlTree = new AVLTree();
mediator.treeList = new TreeLinkedList();
mediator.resultHandler = this;
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmMain));
this.txtResult = new System.Windows.Forms.TextBox();
this.optLayout1 = new System.Windows.Forms.RadioButton();
this.imgList = new System.Windows.Forms.ImageList(this.components);
this.optLayout2 = new System.Windows.Forms.RadioButton();
this.optLayout3 = new System.Windows.Forms.RadioButton();
this.optLayout4 = new System.Windows.Forms.RadioButton();
this.optLayout5 = new System.Windows.Forms.RadioButton();
this.optLayout6 = new System.Windows.Forms.RadioButton();
this.btnBegin = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.optLayout7 = new System.Windows.Forms.RadioButton();
this.optLayout8 = new System.Windows.Forms.RadioButton();
this.optLayout10 = new System.Windows.Forms.RadioButton();
this.optLayout9 = new System.Windows.Forms.RadioButton();
this.lblInfo = new System.Windows.Forms.Label();
this.nupLayoutsPerLine = new System.Windows.Forms.NumericUpDown();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.btnStop = new System.Windows.Forms.Button();
this.stbInfo = new System.Windows.Forms.StatusBar();
this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel();
this.statusBarPanel3 = new System.Windows.Forms.StatusBarPanel();
((System.ComponentModel.ISupportInitialize)(this.nupLayoutsPerLine)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel3)).BeginInit();
this.SuspendLayout();
//
// txtResult
//
this.txtResult.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtResult.BackColor = System.Drawing.Color.Ivory;
this.txtResult.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.txtResult.Location = new System.Drawing.Point(8, 80);
this.txtResult.Multiline = true;
this.txtResult.Name = "txtResult";
this.txtResult.ReadOnly = true;
this.txtResult.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.txtResult.Size = new System.Drawing.Size(776, 424);
this.txtResult.TabIndex = 0;
this.txtResult.Text = "";
this.txtResult.WordWrap = false;
//
// optLayout1
//
this.optLayout1.Checked = true;
this.optLayout1.ImageIndex = 0;
this.optLayout1.ImageList = this.imgList;
this.optLayout1.Location = new System.Drawing.Point(8, 8);
this.optLayout1.Name = "optLayout1";
this.optLayout1.Size = new System.Drawing.Size(64, 64);
this.optLayout1.TabIndex = 1;
this.optLayout1.TabStop = true;
this.optLayout1.CheckedChanged += new System.EventHandler(this.optLayout_CheckedChanged);
//
// imgList
//
this.imgList.ImageSize = new System.Drawing.Size(38, 47);
this.imgList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imgList.ImageStream")));
this.imgList.TransparentColor = System.Drawing.Color.Transparent;
//
// optLayout2
//
this.optLayout2.ImageIndex = 1;
this.optLayout2.ImageList = this.imgList;
this.optLayout2.Location = new System.Drawing.Point(80, 8);
this.optLayout2.Name = "optLayout2";
this.optLayout2.Size = new System.Drawing.Size(64, 64);
this.optLayout2.TabIndex = 2;
this.optLayout2.CheckedChanged += new System.EventHandler(this.optLayout_CheckedChanged);
//
// optLayout3
//
this.optLayout3.ImageIndex = 2;
this.optLayout3.ImageList = this.imgList;
this.optLayout3.Location = new System.Drawing.Point(152, 8);
this.optLayout3.Name = "optLayout3";
this.optLayout3.Size = new System.Drawing.Size(64, 64);
this.optLayout3.TabIndex = 4;
this.optLayout3.CheckedChanged += new System.EventHandler(this.optLayout_CheckedChanged);
//
// optLayout4
//
this.optLayout4.ImageIndex = 3;
this.optLayout4.ImageList = this.imgList;
this.optLayout4.Location = new System.Drawing.Point(224, 8);
this.optLayout4.Name = "optLayout4";
this.optLayout4.Size = new System.Drawing.Size(64, 64);
this.optLayout4.TabIndex = 3;
this.optLayout4.CheckedChanged += new System.EventHandler(this.optLayout_CheckedChanged);
//
// optLayout5
//
this.optLayout5.ImageIndex = 4;
this.optLayout5.ImageList = this.imgList;
this.optLayout5.Location = new System.Drawing.Point(296, 8);
this.optLayout5.Name = "optLayout5";
this.optLayout5.Size = new System.Drawing.Size(64, 64);
this.optLayout5.TabIndex = 6;
this.optLayout5.CheckedChanged += new System.EventHandler(this.optLayout_CheckedChanged);
//
// optLayout6
//
this.optLayout6.ImageIndex = 5;
this.optLayout6.ImageList = this.imgList;
this.optLayout6.Location = new System.Drawing.Point(368, 8);
this.optLayout6.Name = "optLayout6";
this.optLayout6.Size = new System.Drawing.Size(64, 64);
this.optLayout6.TabIndex = 5;
this.optLayout6.CheckedChanged += new System.EventHandler(this.optLayout_CheckedChanged);
//
// btnBegin
//
this.btnBegin.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnBegin.Location = new System.Drawing.Point(8, 512);
this.btnBegin.Name = "btnBegin";
this.btnBegin.Size = new System.Drawing.Size(80, 32);
this.btnBegin.TabIndex = 7;
this.btnBegin.Text = "开始(&B)";
this.btnBegin.Click += new System.EventHandler(this.btnBegin_Click);
//
// btnExit
//
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnExit.Location = new System.Drawing.Point(704, 512);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(80, 32);
this.btnExit.TabIndex = 9;
this.btnExit.Text = "退出(&X)";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// optLayout7
//
this.optLayout7.ImageIndex = 6;
this.optLayout7.ImageList = this.imgList;
this.optLayout7.Location = new System.Drawing.Point(440, 8);
this.optLayout7.Name = "optLayout7";
this.optLayout7.Size = new System.Drawing.Size(64, 64);
this.optLayout7.TabIndex = 11;
this.optLayout7.CheckedChanged += new System.EventHandler(this.optLayout_CheckedChanged);
//
// optLayout8
//
this.optLayout8.ImageIndex = 7;
this.optLayout8.ImageList = this.imgList;
this.optLayout8.Location = new System.Drawing.Point(512, 8);
this.optLayout8.Name = "optLayout8";
this.optLayout8.Size = new System.Drawing.Size(64, 64);
this.optLayout8.TabIndex = 10;
this.optLayout8.CheckedChanged += new System.EventHandler(this.optLayout_CheckedChanged);
//
// optLayout10
//
this.optLayout10.ImageIndex = 9;
this.optLayout10.ImageList = this.imgList;
this.optLayout10.Location = new System.Drawing.Point(656, 8);
this.optLayout10.Name = "optLayout10";
this.optLayout10.Size = new System.Drawing.Size(64, 64);
this.optLayout10.TabIndex = 13;
this.optLayout10.CheckedChanged += new System.EventHandler(this.optLayout_CheckedChanged);
//
// optLayout9
//
this.optLayout9.ImageIndex = 8;
this.optLayout9.ImageList = this.imgList;
this.optLayout9.Location = new System.Drawing.Point(584, 8);
this.optLayout9.Name = "optLayout9";
this.optLayout9.Size = new System.Drawing.Size(64, 64);
this.optLayout9.TabIndex = 12;
this.optLayout9.CheckedChanged += new System.EventHandler(this.optLayout_CheckedChanged);
//
// lblInfo
//
this.lblInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblInfo.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.lblInfo.Location = new System.Drawing.Point(344, 512);
this.lblInfo.Name = "lblInfo";
this.lblInfo.Size = new System.Drawing.Size(352, 32);
this.lblInfo.TabIndex = 14;
this.lblInfo.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// nupLayoutsPerLine
//
this.nupLayoutsPerLine.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.nupLayoutsPerLine.Location = new System.Drawing.Point(240, 518);
this.nupLayoutsPerLine.Maximum = new System.Decimal(new int[] {
10,
0,
0,
0});
this.nupLayoutsPerLine.Minimum = new System.Decimal(new int[] {
1,
0,
0,
0});
this.nupLayoutsPerLine.Name = "nupLayoutsPerLine";
this.nupLayoutsPerLine.Size = new System.Drawing.Size(40, 21);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -