Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //MyForm.h
- #pragma once
- namespace an1me {
- 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>
- /// Сводка для MyForm
- /// </summary>
- public ref class MyForm : public System::Windows::Forms::Form
- {
- public:
- MyForm(void)
- {
- InitializeComponent();
- //
- //TODO: добавьте код конструктора
- //
- }
- protected:
- /// <summary>
- /// Освободить все используемые ресурсы.
- /// </summary>
- ~MyForm()
- {
- if (components)
- {
- delete components;
- }
- }
- protected:
- private: System::Windows::Forms::Timer^ timer1;
- private: System::Windows::Forms::Button^ button1;
- private: System::Windows::Forms::Button^ button2;
- private: System::Windows::Forms::PictureBox^ pictureBox1;
- private: System::ComponentModel::IContainer^ components;
- private:
- /// <summary>
- /// Обязательная переменная конструктора.
- /// </summary>
- #pragma region Windows Form Designer generated code
- /// <summary>
- /// Требуемый метод для поддержки конструктора — не изменяйте
- /// содержимое этого метода с помощью редактора кода.
- /// </summary>
- void InitializeComponent(void)
- {
- this->components = (gcnew System::ComponentModel::Container());
- this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
- this->button1 = (gcnew System::Windows::Forms::Button());
- this->button2 = (gcnew System::Windows::Forms::Button());
- this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
- (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->pictureBox1))->BeginInit();
- this->SuspendLayout();
- //
- // timer1
- //
- this->timer1->Tick += gcnew System::EventHandler(this, &MyForm::timer1_Tick);
- //
- // button1
- //
- this->button1->Location = System::Drawing::Point(275, 403);
- this->button1->Name = L"button1";
- this->button1->Size = System::Drawing::Size(88, 27);
- this->button1->TabIndex = 1;
- this->button1->Text = L"Start";
- this->button1->UseVisualStyleBackColor = true;
- this->button1->Click += gcnew System::EventHandler(this, &MyForm::button1_Click);
- //
- // button2
- //
- this->button2->Location = System::Drawing::Point(275, 445);
- this->button2->Name = L"button2";
- this->button2->Size = System::Drawing::Size(88, 28);
- this->button2->TabIndex = 2;
- this->button2->Text = L"Stop";
- this->button2->UseVisualStyleBackColor = true;
- this->button2->Click += gcnew System::EventHandler(this, &MyForm::button2_Click);
- //
- // pictureBox1
- //
- this->pictureBox1->Location = System::Drawing::Point(111, 12);
- this->pictureBox1->Name = L"pictureBox1";
- this->pictureBox1->Size = System::Drawing::Size(355, 308);
- this->pictureBox1->TabIndex = 3;
- this->pictureBox1->TabStop = false;
- this->pictureBox1->Click += gcnew System::EventHandler(this, &MyForm::pictureBox1_Click);
- //
- // MyForm
- //
- this->AutoScaleDimensions = System::Drawing::SizeF(9, 20);
- this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
- this->ClientSize = System::Drawing::Size(676, 505);
- this->Controls->Add(this->pictureBox1);
- this->Controls->Add(this->button2);
- this->Controls->Add(this->button1);
- this->Name = L"MyForm";
- this->Text = L"MyForm";
- (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->pictureBox1))->EndInit();
- this->ResumeLayout(false);
- }
- #pragma endregion
- private: System::Void pictureBox1_Click(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
- timer1->Enabled = true;
- }
- private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
- timer1->Enabled = false;
- }
- private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) {
- int k;
- k = k + 1;
- if (k = 1) {
- Bitmap^ bmp = gcnew Bitmap(450, 350);
- Graphics^ g = Graphics::FromImage(bmp); // холст для рисования
- pictureBox1->Image = bmp; // закрепление к pictureBox
- Bitmap^ image1; // фото загрузки в pictureBox
- image1 = gcnew Bitmap("Screenshot_4.bpm"); // инициализация файл с фото
- pictureBox1->Image = image1;
- }
- }
- };
- }
- //MyForm.cpp
- #include "MyForm.h"
- #include<Windows.h>
- using namespace an1me;
- int main(array<System::String^>^ args) {
- Application::Run(gcnew MyForm());
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement