#pragma once #include "okno1.h" namespace Project24 { 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 for MyForm /// public ref class MyForm : public System::Windows::Forms::Form { public: MyForm(void) { InitializeComponent(); // //TODO: Add the constructor code here // } protected: /// /// Clean up any resources being used. /// ~MyForm() { if (components) { delete components; } } private: System::Windows::Forms::Button^ button1; private: System::Windows::Forms::Button^ button2; private: System::Windows::Forms::Label^ label1; private: System::Windows::Forms::Timer^ timer1; private: System::Windows::Forms::Button^ button3; private: System::ComponentModel::IContainer^ components; protected: private: /// /// Required designer variable. /// #pragma region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// void InitializeComponent(void) { this->components = (gcnew System::ComponentModel::Container()); this->button1 = (gcnew System::Windows::Forms::Button()); this->button2 = (gcnew System::Windows::Forms::Button()); this->label1 = (gcnew System::Windows::Forms::Label()); this->timer1 = (gcnew System::Windows::Forms::Timer(this->components)); this->button3 = (gcnew System::Windows::Forms::Button()); this->SuspendLayout(); // // button1 // this->button1->Location = System::Drawing::Point(86, 103); this->button1->Name = L"button1"; this->button1->Size = System::Drawing::Size(75, 23); this->button1->TabIndex = 0; this->button1->Text = L"button1"; this->button1->UseVisualStyleBackColor = true; this->button1->Click += gcnew System::EventHandler(this, &MyForm::button1_Click); // // button2 // this->button2->Location = System::Drawing::Point(86, 169); this->button2->Name = L"button2"; this->button2->Size = System::Drawing::Size(75, 23); this->button2->TabIndex = 1; this->button2->Text = L"button2"; this->button2->UseVisualStyleBackColor = true; // // label1 // this->label1->AutoSize = true; this->label1->Location = System::Drawing::Point(103, 57); this->label1->Name = L"label1"; this->label1->Size = System::Drawing::Size(35, 13); this->label1->TabIndex = 2; this->label1->Text = L"label1"; // // timer1 // this->timer1->Enabled = true; this->timer1->Interval = 1000; this->timer1->Tick += gcnew System::EventHandler(this, &MyForm::timer1_Tick); // // button3 // this->button3->Location = System::Drawing::Point(213, 249); this->button3->Name = L"button3"; this->button3->Size = System::Drawing::Size(75, 23); this->button3->TabIndex = 3; this->button3->Text = L"button3"; this->button3->UseVisualStyleBackColor = true; // // MyForm // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(476, 396); this->Controls->Add(this->button3); this->Controls->Add(this->label1); this->Controls->Add(this->button2); this->Controls->Add(this->button1); this->Name = L"MyForm"; this->Text = L"MyForm"; this->ResumeLayout(false); this->PerformLayout(); } okno1^okno; int a; int b; #pragma endregion private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { okno = gcnew okno1; this->Hide(); okno->ShowDialog(); this->Show(); b = okno->x; timer1->Interval = b; } //private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) { //b = okno->x; //label1->Text = a.ToString(); //timer1->Interval =b; //} private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) { a++; label1->Text = a.ToString(); button3->Location =Point (rand() % 300, rand() % 200); } }; }