2,640
社区成员
发帖
与我相关
我的任务
分享
#pragma once
#include "World.h"
World world; //全局变量
namespace WolfandSheep {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Form1 摘要
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: 在此处添加构造函数代码
//
}
protected:
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
protected:
private: System::Windows::Forms::PictureBox^ pictureBox1;
private: System::Windows::Forms::Timer^ timer1;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::NumericUpDown^ Wolfcounts;
private: System::Windows::Forms::NumericUpDown^ Sheepcounts;
private: System::Windows::Forms::NumericUpDown^ numGridSize;
private: System::Windows::Forms::Button^ btninit;
private: System::Windows::Forms::Button^ btnstart;
private: System::Windows::Forms::Button^ btnstop;
private: System::Windows::Forms::Button^ btnclose;
private: System::Windows::Forms::GroupBox^ groupBox1;
private:
private: System::Windows::Forms::Panel^ panel1;
private:System::ComponentModel::IContainer^ components;
/// <summary>
/// 必需的设计器变量。
/// </summary>
array<PictureBox^,2>^ gPic;
ImageList^ gImageList;
#pragma region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
void InitializeComponent(void)
{
this->components = (gcnew System::ComponentModel::Container());
this->panel1 = (gcnew System::Windows::Forms::Panel());
this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->label3 = (gcnew System::Windows::Forms::Label());
this->Wolfcounts = (gcnew System::Windows::Forms::NumericUpDown());
this->Sheepcounts = (gcnew System::Windows::Forms::NumericUpDown());
this->numGridSize = (gcnew System::Windows::Forms::NumericUpDown());
this->btninit = (gcnew System::Windows::Forms::Button());
this->btnstart = (gcnew System::Windows::Forms::Button());
this->btnstop = (gcnew System::Windows::Forms::Button());
this->btnclose = (gcnew System::Windows::Forms::Button());
this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->BeginInit();
this->groupBox1->SuspendLayout();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->Wolfcounts))->BeginInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->Sheepcounts))->BeginInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numGridSize))->BeginInit();
this->SuspendLayout();
//
// panel1
//
this->panel1->Location = System::Drawing::Point(0, 1);
this->panel1->Margin = System::Windows::Forms::Padding(4);
this->panel1->Name = L"panel1";
this->panel1->Size = System::Drawing::Size(890, 594);
this->panel1->TabIndex = 0;
//
// pictureBox1
//
this->pictureBox1->Location = System::Drawing::Point(56, 42);
this->pictureBox1->Margin = System::Windows::Forms::Padding(4);
this->pictureBox1->Name = L"pictureBox1";
this->pictureBox1->Size = System::Drawing::Size(776, 501);
this->pictureBox1->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;
this->pictureBox1->TabIndex = 0;
this->pictureBox1->TabStop = false;
//
// timer1
//
this->timer1->Interval = 1000;
this->timer1->Tick += gcnew System::EventHandler(this, &Form1::timer1_Tick);
//
// label1
//
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"宋体", 10.8F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(134)));
this->label1->Location = System::Drawing::Point(33, 56);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(85, 19);
this->label1->TabIndex = 1;
this->label1->Text = L"狼的数量";
//
// label2
//
this->label2->AutoSize = true;
this->label2->Font = (gcnew System::Drawing::Font(L"宋体", 10.8F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(134)));
this->label2->Location = System::Drawing::Point(34, 107);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(85, 19);
this->label2->TabIndex = 2;
this->label2->Text = L"羊的数量";
//
// label3
//
this->label3->AutoSize = true;
this->label3->Font = (gcnew System::Drawing::Font(L"宋体", 10.8F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(134)));
this->label3->Location = System::Drawing::Point(34, 153);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(85, 19);
this->label3->TabIndex = 3;
this->label3->Text = L"网格数量";
//
// Wolfcounts
//
this->Wolfcounts->Location = System::Drawing::Point(135, 53);
this->Wolfcounts->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {99, 0, 0, 0});
this->Wolfcounts->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0});
this->Wolfcounts->Name = L"Wolfcounts";
this->Wolfcounts->Size = System::Drawing::Size(84, 25);
this->Wolfcounts->TabIndex = 4;
this->Wolfcounts->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {5, 0, 0, 0});
this->Wolfcounts->ValueChanged += gcnew System::EventHandler(this, &Form1::Wolfcounts_ValueChanged);
//
// Sheepcounts
//
this->Sheepcounts->Location = System::Drawing::Point(135, 104);
this->Sheepcounts->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {99, 0, 0, 0});
this->Sheepcounts->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0});
this->Sheepcounts->Name = L"Sheepcounts";
this->Sheepcounts->Size = System::Drawing::Size(84, 25);
this->Sheepcounts->TabIndex = 5;
this->Sheepcounts->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {20, 0, 0, 0});
this->Sheepcounts->ValueChanged += gcnew System::EventHandler(this, &Form1::Sheepcounts_ValueChanged);
//
// numGridSize
//
this->numGridSize->Location = System::Drawing::Point(135, 149);
this->numGridSize->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {30, 0, 0, 0});
this->numGridSize->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {5, 0, 0, 0});
this->numGridSize->Name = L"numGridSize";
this->numGridSize->Size = System::Drawing::Size(84, 25);
this->numGridSize->TabIndex = 6;
this->numGridSize->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {10, 0, 0, 0});
this->numGridSize->ValueChanged += gcnew System::EventHandler(this, &Form1::numGridSize_ValueChanged);
//
// btninit
//
this->btninit->Location = System::Drawing::Point(42, 280);
this->btninit->Name = L"btninit";
this->btninit->Size = System::Drawing::Size(176, 39);
this->btninit->TabIndex = 7;
this->btninit->Text = L"初始化";
this->btninit->UseVisualStyleBackColor = true;
this->btninit->Click += gcnew System::EventHandler(this, &Form1::btninit_Click);
//
// btnstart
//
this->btnstart->Location = System::Drawing::Point(42, 347);
this->btnstart->Name = L"btnstart";
this->btnstart->Size = System::Drawing::Size(177, 40);
this->btnstart->TabIndex = 8;
this->btnstart->Text = L"开始";
this->btnstart->UseVisualStyleBackColor = true;
this->btnstart->Click += gcnew System::EventHandler(this, &Form1::btnstart_Click);
//
// btnstop
//
this->btnstop->Location = System::Drawing::Point(42, 414);
this->btnstop->Name = L"btnstop";
this->btnstop->Size = System::Drawing::Size(177, 41);
this->btnstop->TabIndex = 9;
this->btnstop->Text = L"暂停";
this->btnstop->UseVisualStyleBackColor = true;
this->btnstop->Click += gcnew System::EventHandler(this, &Form1::btnstop_Click);
//