Facebook
From Diminutive Macaque, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 135
  1. #pragma once
  2.  
  3. namespace Project6 {
  4.  
  5.         using namespace System;
  6.         using namespace System::ComponentModel;
  7.         using namespace System::Collections;
  8.         using namespace System::Windows::Forms;
  9.         using namespace System::Data;
  10.         using namespace System::Drawing;
  11.  
  12.         /// <summary>
  13.         /// Summary for MyForm
  14.         /// </summary>
  15.         public ref class MyForm : public System::Windows::Forms::Form
  16.         {
  17.         public:
  18.                 MyForm(void)
  19.                 {
  20.                         InitializeComponent();
  21.                         //
  22.                         //TODO: Add the constructor code here
  23.                         //
  24.                 }
  25.  
  26.         protected:
  27.                 /// <summary>
  28.                 /// Clean up any resources being used.
  29.                 /// </summary>
  30.                 ~MyForm()
  31.                 {
  32.                         if (components)
  33.                         {
  34.                                 delete components;
  35.                         }
  36.                 }
  37.         private: System::Windows::Forms::Button^  button1;
  38.         private: System::Windows::Forms::Label^  label1;
  39.         private: System::Windows::Forms::TextBox^  textBox1;
  40.         private: System::Windows::Forms::Label^  label2;
  41.         private: System::Windows::Forms::Button^  button2;
  42.         private: System::Windows::Forms::Button^  button3;
  43.         protected:
  44.  
  45.         protected:
  46.  
  47.         protected:
  48.  
  49.         private:
  50.                 /// <summary>
  51.                 /// Required designer variable.
  52.                 /// </summary>
  53.                 System::ComponentModel::Container ^components;
  54.  
  55. #pragma region Windows Form Designer generated code
  56.                 /// <summary>
  57.                 /// Required method for Designer support - do not modify
  58.                 /// the contents of this method with the code editor.
  59.                 /// </summary>
  60.                 void InitializeComponent(void)
  61.                 {
  62.                         this->button1 = (gcnew System::Windows::Forms::Button());
  63.                         this->label1 = (gcnew System::Windows::Forms::Label());
  64.                         this->textBox1 = (gcnew System::Windows::Forms::TextBox());
  65.                         this->label2 = (gcnew System::Windows::Forms::Label());
  66.                         this->button2 = (gcnew System::Windows::Forms::Button());
  67.                         this->button3 = (gcnew System::Windows::Forms::Button());
  68.                         this->SuspendLayout();
  69.                         //
  70.                         // button1
  71.                         //
  72.                         this->button1->Location = System::Drawing::Point(18, 75);
  73.                         this->button1->Name = L"button1";
  74.                         this->button1->Size = System::Drawing::Size(75, 23);
  75.                         this->button1->TabIndex = 0;
  76.                         this->button1->Text = L"Oblicz";
  77.                         this->button1->UseVisualStyleBackColor = true;
  78.                         this->button1->Click += gcnew System::EventHandler(this, &MyForm::button1_Click);
  79.                         //
  80.                         // label1
  81.                         //
  82.                         this->label1->Location = System::Drawing::Point(15, 128);
  83.                         this->label1->Name = L"label1";
  84.                         this->label1->Size = System::Drawing::Size(257, 30);
  85.                         this->label1->TabIndex = 1;
  86.                         this->label1->Text = L"\r\n";
  87.                         this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
  88.                         //
  89.                         // textBox1
  90.                         //
  91.                         this->textBox1->Location = System::Drawing::Point(119, 33);
  92.                         this->textBox1->Name = L"textBox1";
  93.                         this->textBox1->Size = System::Drawing::Size(72, 20);
  94.                         this->textBox1->TabIndex = 2;
  95.                         this->textBox1->TextChanged += gcnew System::EventHandler(this, &MyForm::textBox1_TextChanged);
  96.                         //
  97.                         // label2
  98.                         //
  99.                         this->label2->AutoSize = true;
  100.                         this->label2->Location = System::Drawing::Point(12, 36);
  101.                         this->label2->Name = L"label2";
  102.                         this->label2->Size = System::Drawing::Size(101, 13);
  103.                         this->label2->TabIndex = 3;
  104.                         this->label2->Text = L"Wprowadź wartość:";
  105.                         this->label2->Click += gcnew System::EventHandler(this, &MyForm::label2_Click);
  106.                         //
  107.                         // button2
  108.                         //
  109.                         this->button2->Location = System::Drawing::Point(100, 213);
  110.                         this->button2->Name = L"button2";
  111.                         this->button2->Size = System::Drawing::Size(75, 23);
  112.                         this->button2->TabIndex = 4;
  113.                         this->button2->Text = L"Zamknij";
  114.                         this->button2->UseVisualStyleBackColor = true;
  115.                         this->button2->MouseClick += gcnew System::Windows::Forms::MouseEventHandler(this, &MyForm::button2_MouseClick);
  116.                         //
  117.                         // button3
  118.                         //
  119.                         this->button3->Location = System::Drawing::Point(100, 171);
  120.                         this->button3->Name = L"button3";
  121.                         this->button3->Size = System::Drawing::Size(75, 23);
  122.                         this->button3->TabIndex = 5;
  123.                         this->button3->Text = L"Reset";
  124.                         this->button3->UseVisualStyleBackColor = true;
  125.                         this->button3->Click += gcnew System::EventHandler(this, &MyForm::button3_Click);
  126.                         //
  127.                         // MyForm
  128.                         //
  129.                         this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
  130.                         this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
  131.                         this->ClientSize = System::Drawing::Size(284, 262);
  132.                         this->Controls->Add(this->button3);
  133.                         this->Controls->Add(this->button2);
  134.                         this->Controls->Add(this->label2);
  135.                         this->Controls->Add(this->textBox1);
  136.                         this->Controls->Add(this->label1);
  137.                         this->Controls->Add(this->button1);
  138.                         this->Name = L"MyForm";
  139.                         this->Text = L"Jebanie disa";
  140.                         this->ResumeLayout(false);
  141.                         this->PerformLayout();
  142.  
  143.                 }
  144. #pragma endregion
  145.         private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
  146.                 double a;
  147.                 a = Double::Parse(textBox1->Text);
  148.                 double wynik;
  149.                 wynik = a*a;
  150.                 if (a == 0)
  151.                 {
  152.                        
  153.                         label1->Text = "";
  154.                 }
  155.                 else
  156.                 {
  157.                         label1->Text = "Potęga wynosi: " + wynik.ToString();
  158.                 }
  159.         }
  160.         private: System::Void textBox1_TextChanged(System::Object^  sender, System::EventArgs^  e) {
  161.         }
  162.         private: System::Void label2_Click(System::Object^  sender, System::EventArgs^  e) {
  163.         }
  164. private: System::Void button2_MouseClick(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
  165.         Close();
  166. }
  167. private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
  168.         label1->Text = "";
  169.         textBox1->Text = "0";
  170. }
  171. };
  172. }