Advertisement
Rtyrewyger123

Untitled

Apr 22nd, 2020
2,797
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //MyForm.h
  2. #pragma once
  3.  
  4. namespace an1me {
  5.  
  6.     using namespace System;
  7.     using namespace System::ComponentModel;
  8.     using namespace System::Collections;
  9.     using namespace System::Windows::Forms;
  10.     using namespace System::Data;
  11.     using namespace System::Drawing;
  12.  
  13.     /// <summary>
  14.     /// Сводка для MyForm
  15.     /// </summary>
  16.     public ref class MyForm : public System::Windows::Forms::Form
  17.     {
  18.     public:
  19.         MyForm(void)
  20.         {
  21.             InitializeComponent();
  22.             //
  23.             //TODO: добавьте код конструктора
  24.             //
  25.         }
  26.  
  27.     protected:
  28.         /// <summary>
  29.         /// Освободить все используемые ресурсы.
  30.         /// </summary>
  31.         ~MyForm()
  32.         {
  33.             if (components)
  34.             {
  35.                 delete components;
  36.             }
  37.         }
  38.  
  39.     protected:
  40.     private: System::Windows::Forms::Timer^ timer1;
  41.     private: System::Windows::Forms::Button^ button1;
  42.     private: System::Windows::Forms::Button^ button2;
  43.     private: System::Windows::Forms::PictureBox^ pictureBox1;
  44.     private: System::ComponentModel::IContainer^ components;
  45.  
  46.     private:
  47.         /// <summary>
  48.         /// Обязательная переменная конструктора.
  49.         /// </summary>
  50.  
  51.  
  52. #pragma region Windows Form Designer generated code
  53.         /// <summary>
  54.         /// Требуемый метод для поддержки конструктора — не изменяйте
  55.         /// содержимое этого метода с помощью редактора кода.
  56.         /// </summary>
  57.         void InitializeComponent(void)
  58.         {
  59.             this->components = (gcnew System::ComponentModel::Container());
  60.             this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
  61.             this->button1 = (gcnew System::Windows::Forms::Button());
  62.             this->button2 = (gcnew System::Windows::Forms::Button());
  63.             this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
  64.             (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->pictureBox1))->BeginInit();
  65.             this->SuspendLayout();
  66.             //
  67.             // timer1
  68.             //
  69.             this->timer1->Tick += gcnew System::EventHandler(this, &MyForm::timer1_Tick);
  70.             //
  71.             // button1
  72.             //
  73.             this->button1->Location = System::Drawing::Point(275, 403);
  74.             this->button1->Name = L"button1";
  75.             this->button1->Size = System::Drawing::Size(88, 27);
  76.             this->button1->TabIndex = 1;
  77.             this->button1->Text = L"Start";
  78.             this->button1->UseVisualStyleBackColor = true;
  79.             this->button1->Click += gcnew System::EventHandler(this, &MyForm::button1_Click);
  80.             //
  81.             // button2
  82.             //
  83.             this->button2->Location = System::Drawing::Point(275, 445);
  84.             this->button2->Name = L"button2";
  85.             this->button2->Size = System::Drawing::Size(88, 28);
  86.             this->button2->TabIndex = 2;
  87.             this->button2->Text = L"Stop";
  88.             this->button2->UseVisualStyleBackColor = true;
  89.             this->button2->Click += gcnew System::EventHandler(this, &MyForm::button2_Click);
  90.             //
  91.             // pictureBox1
  92.             //
  93.             this->pictureBox1->Location = System::Drawing::Point(111, 12);
  94.             this->pictureBox1->Name = L"pictureBox1";
  95.             this->pictureBox1->Size = System::Drawing::Size(355, 308);
  96.             this->pictureBox1->TabIndex = 3;
  97.             this->pictureBox1->TabStop = false;
  98.             this->pictureBox1->Click += gcnew System::EventHandler(this, &MyForm::pictureBox1_Click);
  99.             //
  100.             // MyForm
  101.             //
  102.             this->AutoScaleDimensions = System::Drawing::SizeF(9, 20);
  103.             this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
  104.             this->ClientSize = System::Drawing::Size(676, 505);
  105.             this->Controls->Add(this->pictureBox1);
  106.             this->Controls->Add(this->button2);
  107.             this->Controls->Add(this->button1);
  108.             this->Name = L"MyForm";
  109.             this->Text = L"MyForm";
  110.             (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->pictureBox1))->EndInit();
  111.             this->ResumeLayout(false);
  112.  
  113.         }
  114. #pragma endregion
  115.     private: System::Void pictureBox1_Click(System::Object^ sender, System::EventArgs^ e) {
  116.  
  117.     }
  118.     private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
  119.         timer1->Enabled = true;
  120.     }
  121.     private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
  122.         timer1->Enabled = false;
  123.     }
  124. private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) {
  125.     int k;
  126.     k = k + 1;
  127.     if (k = 1) {
  128.         Bitmap^ bmp = gcnew Bitmap(450, 350);
  129.         Graphics^ g = Graphics::FromImage(bmp); // холст для рисования
  130.         pictureBox1->Image = bmp; // закрепление к pictureBox
  131.         Bitmap^ image1; // фото загрузки в pictureBox
  132.    
  133.         image1 = gcnew Bitmap("Screenshot_4.bpm"); // инициализация файл с фото
  134.         pictureBox1->Image = image1;
  135.     }
  136.    
  137. }
  138. };
  139. }
  140. //MyForm.cpp
  141. #include "MyForm.h"
  142. #include<Windows.h>
  143. using namespace an1me;
  144. int main(array<System::String^>^ args) {
  145.     Application::Run(gcnew MyForm());
  146.     return 0;
  147. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement