From 6ec61f84c354ed5c78a9782e678b425068fee846 Mon Sep 17 00:00:00 2001 From: Andrew Guschin Date: Tue, 10 Nov 2020 00:01:05 +0300 Subject: =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B3=D0=BE=D1=82=D0=BE=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=88=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD=20=D0=BA=205=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- task05/Guschin/MyForm.h | 104 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 task05/Guschin/MyForm.h (limited to 'task05/Guschin/MyForm.h') diff --git a/task05/Guschin/MyForm.h b/task05/Guschin/MyForm.h new file mode 100644 index 0000000..09f0cd7 --- /dev/null +++ b/task05/Guschin/MyForm.h @@ -0,0 +1,104 @@ +#pragma once + +namespace Guschin { + + using namespace System; + using namespace System::ComponentModel; + using namespace System::Collections; + using namespace System::Windows::Forms; + using namespace System::Data; + using namespace System::Drawing; + using namespace std; + + mat3 T; + mat3 initT; + + public ref class MyForm : public System::Windows::Forms::Form + { + public: + MyForm(void) + { + InitializeComponent(); + } + + protected: + ~MyForm() + { + if (components) + { + delete components; + } + } + + private: + System::ComponentModel::Container ^components; + +#pragma region Windows Form Designer generated code + void InitializeComponent(void) + { + this->SuspendLayout(); + // + // MyForm + // + this->AutoScaleDimensions = System::Drawing::SizeF(8, 16); + this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; + this->ClientSize = System::Drawing::Size(737, 686); + this->KeyPreview = true; + this->Margin = System::Windows::Forms::Padding(4, 4, 4, 4); + this->Name = L"MyForm"; + this->Text = L"MyForm"; + this->Load += gcnew System::EventHandler(this, &MyForm::MyForm_Load); + this->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &MyForm::MyForm_Paint); + this->KeyDown += gcnew System::Windows::Forms::KeyEventHandler(this, &MyForm::MyForm_KeyDown); + this->Resize += gcnew System::EventHandler(this, &MyForm::MyForm_Resize); + this->ResumeLayout(false); + + } +#pragma endregion + private: + float left = 30, right = 100, top = 20, bottom = 50; + float minX = left, maxX; + float minY = top, maxY; + float Wcx = left, Wcy; + float Wx, Wy; + + private: + System::Void rectCalc() { + maxX = ClientRectangle.Width - right; + maxY = ClientRectangle.Height - bottom; + Wcy = maxY; + Wx = maxX - left; + Wy = maxY - top; + } + private: + System::Void MyForm_Resize(System::Object^ sender, System::EventArgs^ e) { + rectCalc(); + Refresh(); + } + private: + System::Void MyForm_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) { + Graphics^ g = e->Graphics; + g->Clear(Color::Aquamarine); + + Pen^ rectPen = gcnew Pen(Color::Black, 2); + g->DrawRectangle(rectPen, left, top, Wx, Wy); + } + private: + System::Void MyForm_Load(System::Object^ sender, System::EventArgs^ e) { + rectCalc(); + initT = mat3(1.f); + T = initT; + } + private: + System::Void MyForm_KeyDown(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e) { + switch (e->KeyCode) { + case Keys::Escape: + T = initT; + break; + default: + break; + } + Refresh(); + } + }; +} -- cgit v1.2.3