Очередь в Windows Form
уважаемые господа) Такая вот задача "С помощью Windows From реализовать очередь , которая будет добавлять элементы , удалять первый , выводить первый , выводить последний и выводить размер очереди". И стала такая проблема, объявление в Windows Form отличается от обычного с++ и на простое queue myQueue; , компилятор возмущается. Пробовал сделать так : QueueSystem::String numbers = new QueueSystem::String; , но тоже не подошло. Нужна помощь профессионалов. Заголовочный файл.h
#pragma once
#include <queue>
#include <string>
namespace Program {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
public ref class MenuForm : public System::Windows::Forms::Form
{
private:
Queue<System::String> numbers = new Queue<System::String>;
public:
MenuForm(void)
{
InitializeComponent();
}
protected:
~MenuForm()
{
if (components)
{
delete components;
}
}
public: System::Windows::Forms::Button^ addSave;
public: System::Windows::Forms::TextBox^ textBox_Input;
private: System::Windows::Forms::GroupBox^ groupBox1;
private: System::Windows::Forms::CheckBox^ checkBox1;
private: System::Windows::Forms::CheckBox^ checkBox2;
private: System::Windows::Forms::CheckBox^ checkBox3;
public: System::Windows::Forms::TextBox^ textBox1;
private: System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
void InitializeComponent(void){
this->addSave = (gcnew System::Windows::Forms::Button());
this->textBox_Input = (gcnew System::Windows::Forms::TextBox());
this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
this->checkBox1 = (gcnew System::Windows::Forms::CheckBox());
this->checkBox2 = (gcnew System::Windows::Forms::CheckBox());
this->checkBox3 = (gcnew System::Windows::Forms::CheckBox());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->groupBox1->SuspendLayout();
this->SuspendLayout();
//
// addSave
//
this->addSave->BackColor = System::Drawing::Color::Gold;
this->addSave->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->addSave->Location = System::Drawing::Point(437, 34);
this->addSave->Name = L"addSave";
this->addSave->Size = System::Drawing::Size(101, 30);
this->addSave->TabIndex = 1;
this->addSave->Text = L"Add";
this->addSave->UseVisualStyleBackColor = false;
this->addSave->UseWaitCursor = true;
this->addSave->Click += gcnew System::EventHandler(this, &MenuForm::addSave_Click);
//
// textBox_Input
//
this->textBox_Input->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->textBox_Input->Location = System::Drawing::Point(6, 34);
this->textBox_Input->Multiline = true;
this->textBox_Input->Name = L"textBox_Input";
this->textBox_Input->Size = System::Drawing::Size(425, 30);
this->textBox_Input->TabIndex = 2;
this->textBox_Input->UseWaitCursor = true;
//
// groupBox1
//
this->groupBox1->Controls->Add(this->textBox_Input);
this->groupBox1->Controls->Add(this->addSave);
this->groupBox1->Location = System::Drawing::Point(12, 12);
this->groupBox1->Name = L"groupBox1";
this->groupBox1->Size = System::Drawing::Size(544, 86);
this->groupBox1->TabIndex = 6;
this->groupBox1->TabStop = false;
this->groupBox1->Text = L"Ввод строки в очередь";
this->groupBox1->UseWaitCursor = true;
//
// checkBox1
//
this->checkBox1->AutoSize = true;
this->checkBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->checkBox1->Location = System::Drawing::Point(12, 122);
this->checkBox1->Name = L"checkBox1";
this->checkBox1->Size = System::Drawing::Size(186, 20);
this->checkBox1->TabIndex = 7;
this->checkBox1->Text = L"Изъять первый элемент";
this->checkBox1->UseVisualStyleBackColor = true;
this->checkBox1->UseWaitCursor = true;
//
// checkBox2
//
this->checkBox2->AutoSize = true;
this->checkBox2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->checkBox2->Location = System::Drawing::Point(12, 148);
this->checkBox2->Name = L"checkBox2";
this->checkBox2->Size = System::Drawing::Size(202, 20);
this->checkBox2->TabIndex = 8;
this->checkBox2->Text = L"Получить первый элемент";
this->checkBox2->UseVisualStyleBackColor = true;
this->checkBox2->UseWaitCursor = true;
//
// checkBox3
//
this->checkBox3->AutoSize = true;
this->checkBox3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->checkBox3->Location = System::Drawing::Point(12, 174);
this->checkBox3->Name = L"checkBox3";
this->checkBox3->Size = System::Drawing::Size(194, 20);
this->checkBox3->TabIndex = 9;
this->checkBox3->Text = L"Вывести размер очереди";
this->checkBox3->UseVisualStyleBackColor = true;
this->checkBox3->UseWaitCursor = true;
//
// textBox1
//
this->textBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->textBox1->Location = System::Drawing::Point(12, 200);
this->textBox1->Multiline = true;
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(425, 30);
this->textBox1->TabIndex = 10;
this->textBox1->UseWaitCursor = true;
//
// MenuForm
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->BackColor = System::Drawing::SystemColors::ActiveCaption;
this->ClientSize = System::Drawing::Size(568, 264);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->checkBox3);
this->Controls->Add(this->checkBox2);
this->Controls->Add(this->checkBox1);
this->Controls->Add(this->groupBox1);
this->Cursor = System::Windows::Forms::Cursors::WaitCursor;
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::Fixed3D;
this->MaximizeBox = false;
this->Name = L"MenuForm";
this->SizeGripStyle = System::Windows::Forms::SizeGripStyle::Hide;
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
this->Text = L"Работа с очередью";
this->TopMost = true;
this->TransparencyKey = System::Drawing::Color::Black;
this->UseWaitCursor = true;
this->groupBox1->ResumeLayout(false);
this->groupBox1->PerformLayout();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void addSave_Click(System::Object^ sender, System::EventArgs^ e);
};
}
Исполняемый файл.cpp
#include "MenuForm.h"
using namespace System;
using namespace System::Windows::Forms;
[STAThreadAttribute]
void main(array<String^>^ args) {
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Program::MenuForm form;
Application::Run(%form);
}
System::Void Program::MenuForm::addSave_Click(System::Object^ sender, System::EventArgs^ e)
{
myQueue.push(textBox_Input);
}
Неужели в windows form не внесли queue как класс и нужно самому его создавать ?