Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <math.h>
- #include <string>
- namespace Interface1 {
- double a, r , aps;
- const double PI = 3.141592;
- 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>
- /// Summary for Form1
- ///
- /// WARNING: If you change the name of this class, you will need to change the
- /// 'Resource File Name' property for the managed resource compiler tool
- /// associated with all .resx files this class depends on. Otherwise,
- /// the designers will not be able to interact properly with localized
- /// resources associated with this form.
- /// </summary>
- public ref class Form1 : public System::Windows::Forms::Form
- {
- public:
- Form1(void)
- {
- InitializeComponent();
- //
- //TODO: Add the constructor code here
- //
- }
- protected:
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- ~Form1()
- {
- if (components)
- {
- delete components;
- }
- }
- private: System::Windows::Forms::Label^ label1;
- protected:
- private: System::Windows::Forms::TextBox^ textBox1;
- //private: void suma() ;
- private: System::Windows::Forms::Label^ label3;
- private: System::Windows::Forms::Button^ button1;
- private: System::Windows::Forms::PictureBox^ pictureBox1;
- private: System::Windows::Forms::RadioButton^ radioButton1;
- private: System::Windows::Forms::RadioButton^ radioButton2;
- private: System::Windows::Forms::RadioButton^ radioButton3;
- private: System::Windows::Forms::Label^ label2;
- private: System::Windows::Forms::CheckBox^ checkBox1;
- protected:
- protected:
- private:
- /// <summary>
- /// Required designer variable.
- /// </summary>
- System::ComponentModel::Container ^components;
- #pragma region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- void InitializeComponent(void)
- {
- System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
- this->label1 = (gcnew System::Windows::Forms::Label());
- this->textBox1 = (gcnew System::Windows::Forms::TextBox());
- this->label3 = (gcnew System::Windows::Forms::Label());
- this->button1 = (gcnew System::Windows::Forms::Button());
- this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
- this->radioButton1 = (gcnew System::Windows::Forms::RadioButton());
- this->radioButton2 = (gcnew System::Windows::Forms::RadioButton());
- this->radioButton3 = (gcnew System::Windows::Forms::RadioButton());
- this->label2 = (gcnew System::Windows::Forms::Label());
- this->checkBox1 = (gcnew System::Windows::Forms::CheckBox());
- (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->BeginInit();
- this->SuspendLayout();
- //
- // label1
- //
- this->label1->AutoSize = true;
- this->label1->Location = System::Drawing::Point(249, 21);
- this->label1->Name = L"label1";
- this->label1->Size = System::Drawing::Size(97, 17);
- this->label1->TabIndex = 0;
- this->label1->Text = L"Įveskite a dydį";
- this->label1->Click += gcnew System::EventHandler(this, &Form1::label1_Click_1);
- //
- // textBox1
- //
- this->textBox1->Location = System::Drawing::Point(252, 41);
- this->textBox1->Name = L"textBox1";
- this->textBox1->Size = System::Drawing::Size(100, 22);
- this->textBox1->TabIndex = 2;
- //
- // label3
- //
- this->label3->AutoSize = true;
- this->label3->Location = System::Drawing::Point(12, 149);
- this->label3->Name = L"label3";
- this->label3->Size = System::Drawing::Size(75, 17);
- this->label3->TabIndex = 4;
- this->label3->Text = L"Rezultatas";
- this->label3->Click += gcnew System::EventHandler(this, &Form1::label3_Click);
- //
- // button1
- //
- this->button1->Location = System::Drawing::Point(252, 78);
- this->button1->Name = L"button1";
- this->button1->Size = System::Drawing::Size(100, 41);
- this->button1->TabIndex = 5;
- this->button1->Text = L"Skaičiuoti";
- this->button1->UseVisualStyleBackColor = true;
- this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
- //
- // pictureBox1
- //
- this->pictureBox1->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"pictureBox1.Image")));
- this->pictureBox1->InitialImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"pictureBox1.InitialImage")));
- this->pictureBox1->Location = System::Drawing::Point(15, 21);
- this->pictureBox1->Name = L"pictureBox1";
- this->pictureBox1->Size = System::Drawing::Size(200, 125);
- this->pictureBox1->SizeMode = System::Windows::Forms::PictureBoxSizeMode::AutoSize;
- this->pictureBox1->TabIndex = 6;
- this->pictureBox1->TabStop = false;
- //
- // radioButton1
- //
- this->radioButton1->AutoSize = true;
- this->radioButton1->Location = System::Drawing::Point(378, 41);
- this->radioButton1->Name = L"radioButton1";
- this->radioButton1->Size = System::Drawing::Size(93, 21);
- this->radioButton1->TabIndex = 7;
- this->radioButton1->TabStop = true;
- this->radioButton1->Text = L"Metrai (m)";
- this->radioButton1->UseVisualStyleBackColor = true;
- this->radioButton1->CheckedChanged += gcnew System::EventHandler(this, &Form1::radioButton1_CheckedChanged);
- //
- // radioButton2
- //
- this->radioButton2->AutoSize = true;
- this->radioButton2->Location = System::Drawing::Point(378, 68);
- this->radioButton2->Name = L"radioButton2";
- this->radioButton2->Size = System::Drawing::Size(132, 21);
- this->radioButton2->TabIndex = 8;
- this->radioButton2->TabStop = true;
- this->radioButton2->Text = L"Centimetrai (cm)";
- this->radioButton2->UseVisualStyleBackColor = true;
- //
- // radioButton3
- //
- this->radioButton3->AutoSize = true;
- this->radioButton3->Location = System::Drawing::Point(378, 98);
- this->radioButton3->Name = L"radioButton3";
- this->radioButton3->Size = System::Drawing::Size(53, 21);
- this->radioButton3->TabIndex = 9;
- this->radioButton3->TabStop = true;
- this->radioButton3->Text = L"Kita";
- this->radioButton3->UseVisualStyleBackColor = true;
- //
- // label2
- //
- this->label2->AutoSize = true;
- this->label2->Location = System::Drawing::Point(375, 21);
- this->label2->Name = L"label2";
- this->label2->Size = System::Drawing::Size(121, 17);
- this->label2->TabIndex = 10;
- this->label2->Text = L"Matavimo vienetai";
- //
- // checkBox1
- //
- this->checkBox1->AutoSize = true;
- this->checkBox1->Location = System::Drawing::Point(387, 235);
- this->checkBox1->Name = L"checkBox1";
- this->checkBox1->Size = System::Drawing::Size(123, 21);
- this->checkBox1->TabIndex = 11;
- this->checkBox1->Text = L"Išsaugoti į failą";
- this->checkBox1->UseVisualStyleBackColor = true;
- //
- // Form1
- //
- this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);
- this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
- this->ClientSize = System::Drawing::Size(508, 266);
- this->Controls->Add(this->checkBox1);
- this->Controls->Add(this->label2);
- this->Controls->Add(this->radioButton3);
- this->Controls->Add(this->radioButton2);
- this->Controls->Add(this->radioButton1);
- this->Controls->Add(this->pictureBox1);
- this->Controls->Add(this->button1);
- this->Controls->Add(this->label3);
- this->Controls->Add(this->textBox1);
- this->Controls->Add(this->label1);
- this->Name = L"Form1";
- this->Text = L"Eimantas Kasperiūnas ND1";
- this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
- (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->EndInit();
- this->ResumeLayout(false);
- this->PerformLayout();
- }
- #pragma endregion
- private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void label3_Click(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
- // aprasymo vieta
- string mvnt;
- if(String::IsNullOrEmpty(textBox1->Text)){
- MessageBox::Show(L"Įvesta neteisinga reikšmė." ,
- L"Klaida!",
- MessageBoxButtons::OK,
- MessageBoxIcon::Exclamation);
- }
- else{;
- nuskaitymas(a);
- if (radioButton1->Checked){
- rezultatai(mvnt);}
- }
- }
- private: System::Void label1_Click_1(System::Object^ sender, System::EventArgs^ e) {
- }
- private:void rezultatai(char mvnt) {
- double s = 0;
- label3-> Text=String::Format("Neuzbruksniuotos figuros plotas yra " + plotas(a,r,aps) ) ;
- label3-> Text += "\n";
- // label3-> Text += "666";
- label3->Text += 'mvnt';
- // + "\n" + "Uzbruksniuotos figuros plotas yra " + (pow(a,2) - plotas(a,r,aps) + mat[1,2,3])
- }
- private:void nuskaitymas(double & a) {
- a = Convert::ToDouble(textBox1->Text);
- }
- private:double plotas (double a, double &rombas, double &apskritimas){
- rombas = pow(a,2) - ((a/2)*(a/2))/2*4;
- apskritimas = PI*pow(a/4,2);
- return pow(a,2) - rombas - apskritimas/2;
- }
- private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void progressBar1_Click(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void radioButton1_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement