Главная страница

Разработка приложения с графическим интерфейсом пользователя. Курсовая. Кафедра Цифровые технологии и моделирование


Скачать 0.64 Mb.
НазваниеКафедра Цифровые технологии и моделирование
АнкорРазработка приложения с графическим интерфейсом пользователя
Дата04.10.2022
Размер0.64 Mb.
Формат файлаdocx
Имя файлаКурсовая.docx
ТипДокументы
#714292
страница3 из 4
1   2   3   4



{

using namespace System;

using namespace System::ComponentModel;

using namespace System::Collections;

using namespace System::IO;

using namespace System::Threading;

using namespace System::Windows::Forms;

using namespace System::Windows::Forms::DataVisualization::Charting;

using namespace System::Data;

using namespace System::Drawing;

using namespace System::Runtime::InteropServices;

using namespace std;



public ref class MainForm : public System::Windows::Forms::Form

{

public:

String^ function;

int a1, a2, xmin, xmax;



MainForm(void)

{

InitializeComponent();

Axis^ ax = gcnew Axis();

ax->Title = "x";

chart1->ChartAreas[0]->AxisX = ax;

Axis^ ay = gcnew Axis();

ay->Title = "y";

chart1->ChartAreas[0]->AxisY = ay;

}

protected:

MainForm()

{

if (components)

{

delete components;

}

}

private: System::Windows::Forms::Label^ label4;

protected:

private: System::Windows::Forms::Label^ label3;

private: System::Windows::Forms::DataGridView^ dataGridView1;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ y;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ x;

private: System::Windows::Forms::Button^ button3;

private: System::Windows::Forms::Button^ button2;

private: System::Windows::Forms::RadioButton^ radioButton2;

private: System::Windows::Forms::RadioButton^ radioButton1;

private: System::Windows::Forms::Button^ button1;

private: System::Windows::Forms::TextBox^ textBox2;

private: System::Windows::Forms::Label^ label2;

private: System::Windows::Forms::TextBox^ textBox1;

private: System::Windows::Forms::Label^ label1;

private: System::Windows::Forms::DataVisualization::Charting::Chart^ chart1;

private: System::Windows::Forms::SaveFileDialog^ saveFileDialog1;

private: System::Windows::Forms::OpenFileDialog^ openFileDialog1;

private: System::Windows::Forms::TextBox^ textBox3;

private: System::Windows::Forms::Label^ label5;

private: System::Windows::Forms::TextBox^ textBox4;

private: System::Windows::Forms::Label^ label6;

private: System::ComponentModel::Container^ components;

#pragma region Windows Form Designer generated code

void InitializeComponent(void)

{

System::Windows::Forms::DataVisualization::Charting::ChartArea^ chartArea1 = (gcnew System::Windows::Forms::DataVisualization::Charting::ChartArea());

System::Windows::Forms::DataVisualization::Charting::Legend^ legend1 = (gcnew System::Windows::Forms::DataVisualization::Charting::Legend());

System::Windows::Forms::DataVisualization::Charting::Series^ series1 = (gcnew System::Windows::Forms::DataVisualization::Charting::Series());

this->label4 = (gcnew System::Windows::Forms::Label());

this->label3 = (gcnew System::Windows::Forms::Label());

this->dataGridView1 = (gcnew System::Windows::Forms::DataGridView());

this->y = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->x = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->button3 = (gcnew System::Windows::Forms::Button());

this->button2 = (gcnew System::Windows::Forms::Button());

this->radioButton2 = (gcnew System::Windows::Forms::RadioButton());

this->radioButton1 = (gcnew System::Windows::Forms::RadioButton());

this->button1 = (gcnew System::Windows::Forms::Button());

this->textBox2 = (gcnew System::Windows::Forms::TextBox());

this->label2 = (gcnew System::Windows::Forms::Label());

this->textBox1 = (gcnew System::Windows::Forms::TextBox());

this->label1 = (gcnew System::Windows::Forms::Label());

this->chart1 = (gcnew System::Windows::Forms::DataVisualization::Charting::Chart());

this->saveFileDialog1 = (gcnew System::Windows::Forms::SaveFileDialog());

this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());

this->textBox3 = (gcnew System::Windows::Forms::TextBox());

this->label5 = (gcnew System::Windows::Forms::Label());

this->textBox4 = (gcnew System::Windows::Forms::TextBox());

this->label6 = (gcnew System::Windows::Forms::Label());

(cli::safe_cast(this->dataGridView1))->BeginInit();

(cli::safe_cast(this->chart1))->BeginInit();

this->SuspendLayout();

//

// label4

//

this->label4->AutoSize = true;

this->label4->Location = System::Drawing::Point(218, 27);

this->label4->Name = L"label4";

this->label4->Size = System::Drawing::Size(253, 17);

this->label4->TabIndex = 25;

this->label4->Text = L"График функции a1cos^2x + a2sin^2x";

//

// label3

//

this->label3->AutoSize = true;

this->label3->Location = System::Drawing::Point(902, 27);

this->label3->Name = L"label3";

this->label3->Size = System::Drawing::Size(201, 17);

this->label3->TabIndex = 24;

this->label3->Text = L"Функция a1cos^2x + a2sin^2x";

//

// dataGridView1

//

this->dataGridView1->AllowUserToAddRows = false;

this->dataGridView1->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;

this->dataGridView1->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(2) { this->y, this->x });

this->dataGridView1->Location = System::Drawing::Point(797, 47);

this->dataGridView1->Name = L"dataGridView1";

this->dataGridView1->ReadOnly = true;

this->dataGridView1->RowHeadersWidth = 51;

this->dataGridView1->RowTemplate->Height = 24;

this->dataGridView1->Size = System::Drawing::Size(430, 427);

this->dataGridView1->TabIndex = 23;

//

// y

//

this->y->HeaderText = L"y";

this->y->MinimumWidth = 6;

this->y->Name = L"y";

this->y->ReadOnly = true;

this->y->Width = 125;

//

// x

//

this->x->HeaderText = L"x";

this->x->MinimumWidth = 6;

this->x->Name = L"x";

this->x->ReadOnly = true;

this->x->Width = 125;

//

// button3

//

this->button3->Location = System::Drawing::Point(536, 413);

this->button3->Name = L"button3";

this->button3->Size = System::Drawing::Size(220, 23);

this->button3->TabIndex = 22;

this->button3->Text = L"Прочитать из файла";

this->button3->UseVisualStyleBackColor = true;

this->button3->Click += gcnew System::EventHandler(this, &MainForm::Button3_Click);

//

// button2

//

this->button2->Location = System::Drawing::Point(536, 373);

this->button2->Name = L"button2";

this->button2->Size = System::Drawing::Size(220, 23);

this->button2->TabIndex = 21;

this->button2->Text = L"Записать в файл";

this->button2->UseVisualStyleBackColor = true;

this->button2->Click += gcnew System::EventHandler(this, &MainForm::Button2_Click);

//

// radioButton2

//

this->radioButton2->AutoSize = true;

this->radioButton2->Location = System::Drawing::Point(189, 479);

this->radioButton2->Name = L"radioButton2";

this->radioButton2->Size = System::Drawing::Size(122, 21);

this->radioButton2->TabIndex = 20;

this->radioButton2->Text = L"a1x + a2sin^2x";

this->radioButton2->UseVisualStyleBackColor = true;

//

// radioButton1

//

this->radioButton1->AutoSize = true;

this->radioButton1->Checked = true;

this->radioButton1->Location = System::Drawing::Point(23, 479);

this->radioButton1->Name = L"radioButton1";

this->radioButton1->Size = System::Drawing::Size(159, 21);

this->radioButton1->TabIndex = 19;

this->radioButton1->TabStop = true;

this->radioButton1->Text = L"a1cos^2x + a2sin^2x";

this->radioButton1->UseVisualStyleBackColor = true;

//

// button1

//

this->button1->Location = System::Drawing::Point(23, 517);

this->button1->Name = L"button1";

this->button1->Size = System::Drawing::Size(266, 23);

this->button1->TabIndex = 18;

this->button1->Text = L"Построить график ";

this->button1->UseVisualStyleBackColor = true;

this->button1->Click += gcnew System::EventHandler(this, &MainForm::Button1_Click);

//

// textBox2

//

this->textBox2->Location = System::Drawing::Point(189, 373);

this->textBox2->Name = L"textBox2";

this->textBox2->ShortcutsEnabled = false;

this->textBox2->Size = System::Drawing::Size(100, 22);

this->textBox2->TabIndex = 17;

//

// label2

//

this->label2->AutoSize = true;

this->label2->Location = System::Drawing::Point(186, 352);

this->label2->Name = L"label2";

this->label2->Size = System::Drawing::Size(24, 17);

this->label2->TabIndex = 16;

this->label2->Text = L"a2";

//

// textBox1

//

this->textBox1->Location = System::Drawing::Point(23, 373);

this->textBox1->Name = L"textBox1";

this->textBox1->ShortcutsEnabled = false;

this->textBox1->Size = System::Drawing::Size(100, 22);

this->textBox1->TabIndex = 15;

//

// label1

//

this->label1->AutoSize = true;

this->label1->Location = System::Drawing::Point(20, 353);

this->label1->Name = L"label1";

this->label1->Size = System::Drawing::Size(24, 17);

this->label1->TabIndex = 14;

this->label1->Text = L"a1";

//

// chart1

//

chartArea1->Name = L"ChartArea1";

this->chart1->ChartAreas->Add(chartArea1);

legend1->Name = L"Legend1";

this->chart1->Legends->Add(legend1);

this->chart1->Location = System::Drawing::Point(23, 47);

this->chart1->Name = L"chart1";

series1->ChartArea = L"ChartArea1";

series1->ChartType = System::Windows::Forms::DataVisualization::Charting::SeriesChartType::Spline;

series1->Legend = L"Legend1";

series1->LegendText = L"a1cos^2x + a2sin^2x";

series1->Name = L"Series1";

this->chart1->Series->Add(series1);

this->chart1->Size = System::Drawing::Size(733, 300);

this->chart1->TabIndex = 13;

this->chart1->Text = L"chart1";

//

// saveFileDialog1

//

this->saveFileDialog1->Filter = L"Text files(*.txt)|*.txt|All files(*.*)|*.*";

//

// openFileDialog1

//

this->openFileDialog1->FileName = L"openFileDialog1";

this->openFileDialog1->Filter = L"Text files(*.txt)|*.txt|All files(*.*)|*.*";

//

// textBox3

//

this->textBox3->Location = System::Drawing::Point(23, 430);

this->textBox3->Name = L"textBox3";

this->textBox3->ShortcutsEnabled = false;

this->textBox3->Size = System::Drawing::Size(100, 22);

this->textBox3->TabIndex = 27;

//

// label5

//

this->label5->AutoSize = true;

this->label5->Location = System::Drawing::Point(20, 409);

this->label5->Name = L"label5";

this->label5->Size = System::Drawing::Size(36, 17);

this->label5->TabIndex = 26;

this->label5->Text = L"xmin";

//

// textBox4

//

this->textBox4->Location = System::Drawing::Point(189, 430);

this->textBox4->Name = L"textBox4";

this->textBox4->ShortcutsEnabled = false;

this->textBox4->Size = System::Drawing::Size(100, 22);

this->textBox4->TabIndex = 29;

//

// label6

//

this->label6->AutoSize = true;

this->label6->Location = System::Drawing::Point(186, 409);

this->label6->Name = L"label6";

this->label6->Size = System::Drawing::Size(39, 17);

this->label6->TabIndex = 28;

this->label6->Text = L"xmax";

//

// MainForm

//

this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);

this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;

this->BackColor = System::Drawing::Color::ForestGreen;

this->ClientSize = System::Drawing::Size(1262, 583);

this->Controls->Add(this->textBox4);

this->Controls->Add(this->label6);

this->Controls->Add(this->textBox3);

this->Controls->Add(this->label5);

this->Controls->Add(this->label4);

this->Controls->Add(this->label3);

this->Controls->Add(this->dataGridView1);

this->Controls->Add(this->button3);
1   2   3   4


написать администратору сайта