⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 antsgeneralpage.cs

📁 包括Pheromones Algorythm、Memory Algorythm和Hill Climbing Algorythm I
💻 CS
字号:
using System;
using System.Windows.Forms;

namespace PathFinder
{
	/// <summary>
	/// Summary description for AntsGeneralPage.
	/// </summary>
	public class AntsGeneralPage : System.Windows.Forms.TabPage
	{
		private Button setupButton;

		private GroupBox behaviourGroupBox;
		private CheckBox allwaysFollowPheromoneBox;
		private Label numberOfAntsAffectedLabel;
		private NumericUpDown numberOfAffectedAnts;

		private GroupBox generalOptionsGroupBox;
		private CheckBox occupiedSquaresBox;
		private CheckBox findFoodCheckBox;
		private Label numberOfAntsLabel;
		private NumericUpDown numberOfAnts;

		public int NumberOfAffectedAnts
		{
			get
			{
				return ( int )numberOfAffectedAnts.Value;
			}
			set
			{
				numberOfAffectedAnts.Value = value;
			}
		}

		public int NumberOfAnts
		{
			get
			{
				return ( int )numberOfAnts.Value;
			}
			set
			{
				numberOfAnts.Value = value;
			}
		}

		public bool AlwaysFollowPheromoneBoxChecked
		{
			get
			{
				return allwaysFollowPheromoneBox.Checked;
			}
			set
			{
				allwaysFollowPheromoneBox.Checked = value;
			}
		}

		public bool OccupiedSquaresBoxChecked
		{
			get
			{
				return occupiedSquaresBox.Checked;
			}
			set
			{
				occupiedSquaresBox.Checked = value;
			}
		}

		public AntsGeneralPage( Control parent )
		{
			setupButton = new Button();
			behaviourGroupBox = new GroupBox();
			allwaysFollowPheromoneBox = new CheckBox();
			numberOfAntsAffectedLabel = new Label();
			numberOfAffectedAnts = new NumericUpDown();
			generalOptionsGroupBox = new GroupBox();
			occupiedSquaresBox = new CheckBox();
			findFoodCheckBox = new CheckBox();
			numberOfAntsLabel = new Label();
			numberOfAnts = new NumericUpDown();


			((System.ComponentModel.ISupportInitialize)(this.numberOfAffectedAnts)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numberOfAnts)).BeginInit();
			behaviourGroupBox.SuspendLayout();
			generalOptionsGroupBox.SuspendLayout();
			this.SuspendLayout();

			setupButton.Location = new System.Drawing.Point(392, 24);
			setupButton.Name = "Individual Ants Setup";
			setupButton.Size = new System.Drawing.Size(160, 23);
			setupButton.TabIndex = 3;
			setupButton.Text = "Setup Ants Individually";
			setupButton.Click += new System.EventHandler( ( ( Form1 )parent ).OnSetupAntsIndividually );


			behaviourGroupBox.Controls.Add( allwaysFollowPheromoneBox );
			behaviourGroupBox.Controls.Add( numberOfAntsAffectedLabel );
			behaviourGroupBox.Controls.Add( numberOfAffectedAnts );
			behaviourGroupBox.Location = new System.Drawing.Point(16, 136);
			behaviourGroupBox.Name = "BehaviourGroupBox";
			behaviourGroupBox.Size = new System.Drawing.Size(288, 80);
			behaviourGroupBox.TabStop = false;
			behaviourGroupBox.Text = "Behaviour";

			allwaysFollowPheromoneBox.AutoCheck = false;
			allwaysFollowPheromoneBox.Checked = true;
			allwaysFollowPheromoneBox.CheckState = System.Windows.Forms.CheckState.Checked;
			allwaysFollowPheromoneBox.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			allwaysFollowPheromoneBox.Location = new System.Drawing.Point(8, 48);
			allwaysFollowPheromoneBox.Name = "AllwaysFollowPheromoneBox";
			allwaysFollowPheromoneBox.Size = new System.Drawing.Size(216, 24);
			allwaysFollowPheromoneBox.TabIndex = 2;
			allwaysFollowPheromoneBox.Text = "Do Not Follow Strongest Pheromones";
			allwaysFollowPheromoneBox.Click += new System.EventHandler( ( ( Form1 )parent ).OnDoNotAllwaysFollowStrongestPheromone );
		
			numberOfAntsAffectedLabel.Location = new System.Drawing.Point(136, 24);
			numberOfAntsAffectedLabel.Name = "NumberOfAntsAffectedLabel";
			numberOfAntsAffectedLabel.Size = new System.Drawing.Size(144, 23);
			numberOfAntsAffectedLabel.TabIndex = 1;
			numberOfAntsAffectedLabel.Text = "Number Of Ants Affected";

			numberOfAffectedAnts.Location = new System.Drawing.Point(8, 16);
			numberOfAffectedAnts.Name = "numberOfAffectedAnts";
			numberOfAffectedAnts.TabIndex = 0;
			numberOfAffectedAnts.Value = new System.Decimal(new int[] {
																			   3,
																			   0,
																			   0,
																			   0});

			generalOptionsGroupBox.Controls.Add( occupiedSquaresBox );
			generalOptionsGroupBox.Controls.Add( findFoodCheckBox );
			generalOptionsGroupBox.Controls.Add( numberOfAntsLabel );
			generalOptionsGroupBox.Controls.Add( numberOfAnts );
			generalOptionsGroupBox.Location = new System.Drawing.Point(8, 8);
			generalOptionsGroupBox.Name = "GeneralOptionsGroupBox";
			generalOptionsGroupBox.Size = new System.Drawing.Size(296, 112);
			generalOptionsGroupBox.TabIndex = 1;
			generalOptionsGroupBox.TabStop = false;
			generalOptionsGroupBox.Text = "General";

			occupiedSquaresBox.AutoCheck = false;
			occupiedSquaresBox.Checked = true;
			occupiedSquaresBox.CheckState = System.Windows.Forms.CheckState.Checked;
			occupiedSquaresBox.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			occupiedSquaresBox.Location = new System.Drawing.Point(16, 80);
			occupiedSquaresBox.Name = "OccupiedSquaresBox";
			occupiedSquaresBox.Size = new System.Drawing.Size(216, 24);
			occupiedSquaresBox.TabIndex = 5;
			occupiedSquaresBox.Text = "Try To Avoid Occupied Squares";
			occupiedSquaresBox.Click += new System.EventHandler( ( ( Form1 )parent ).OnTryToAvoidOccupiedSquares);

			findFoodCheckBox.Checked = true;
			findFoodCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
			findFoodCheckBox.Enabled = false;
			findFoodCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			findFoodCheckBox.Location = new System.Drawing.Point(16, 56);
			findFoodCheckBox.Name = "FindFoodCheckBox";
			findFoodCheckBox.TabIndex = 4;
			findFoodCheckBox.Text = "Find Food";


			numberOfAntsLabel.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			numberOfAntsLabel.Location = new System.Drawing.Point(144, 24);
			numberOfAntsLabel.Name = "NumberOfAntsLabel";
			numberOfAntsLabel.TabIndex = 3;
			numberOfAntsLabel.Text = "Number Of Ants";

			
			numberOfAnts.Location = new System.Drawing.Point(16, 24);
			numberOfAnts.Maximum = new System.Decimal(new int[] {
																		 50,
																		 0,
																		 0,
																		 0});
			numberOfAnts.Minimum = new System.Decimal(new int[] {
																		 1,
																		 0,
																		 0,
																		 0});
			numberOfAnts.Name = "NumberOfAnts";
			numberOfAnts.TabIndex = 2;
			numberOfAnts.Value = new System.Decimal(new int[] {
																	   10,
																	   0,
																	   0,
																	   0});

			this.Controls.Add( setupButton );
			this.Controls.Add( behaviourGroupBox );
			this.Controls.Add( generalOptionsGroupBox );
			this.Location = new System.Drawing.Point(4, 22);
			this.Name = "AntsGeneralPage";
			this.Size = new System.Drawing.Size(616, 230);
			this.TabIndex = 1;
			this.Text = "Ants General";


			((System.ComponentModel.ISupportInitialize)(this.numberOfAffectedAnts)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numberOfAnts)).EndInit();

			behaviourGroupBox.ResumeLayout( false );
			generalOptionsGroupBox.ResumeLayout( false );
			this.ResumeLayout( false );

			setupButton.Enabled = false;

		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -