#pragma once #include "okno.h" namespace Project8 { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; vector P; /// /// Summary for MyForm /// /// WARNING: If you change the name of this class, you will need to change the /// 'Resource File Name' property for the managed resource compiler tool /// associated with all .resx files this class depends on. Otherwise, /// the designers will not be able to interact properly with localized /// resources associated with this form. /// 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::Panel^ panel1; protected: private: System::Windows::Forms::PictureBox^ pictureBox1; private: /// /// Required designer variable. /// System::ComponentModel::Container ^components; #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->panel1 = (gcnew System::Windows::Forms::Panel()); this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox()); (cli::safe_cast(this->pictureBox1))->BeginInit(); this->SuspendLayout(); // // panel1 // this->panel1->Dock = System::Windows::Forms::DockStyle::Left; this->panel1->Location = System::Drawing::Point(0, 0); this->panel1->Name = L"panel1"; this->panel1->Size = System::Drawing::Size(159, 300); this->panel1->TabIndex = 0; // // pictureBox1 // this->pictureBox1->Dock = System::Windows::Forms::DockStyle::Fill; this->pictureBox1->Location = System::Drawing::Point(159, 0); this->pictureBox1->Name = L"pictureBox1"; this->pictureBox1->Size = System::Drawing::Size(293, 300); this->pictureBox1->TabIndex = 1; this->pictureBox1->TabStop = false; this->pictureBox1->MouseMove += gcnew System::Windows::Forms::MouseEventHandler(this, &MyForm::pictureBox1_MouseMove); this->pictureBox1->Resize += gcnew System::EventHandler(this, &MyForm::pictureBox1_Resize); this->pictureBox1->MouseDown += gcnew System::Windows::Forms::MouseEventHandler(this, &MyForm::pictureBox1_MouseDown); this->pictureBox1->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &MyForm::pictureBox1_Paint); // // MyForm // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(452, 300); this->Controls->Add(this->pictureBox1); this->Controls->Add(this->panel1); this->Name = L"MyForm"; this->Text = L"Start"; this->Load += gcnew System::EventHandler(this, &MyForm::MyForm_Load); (cli::safe_cast(this->pictureBox1))->EndInit(); this->ResumeLayout(false); } #pragma endregion TOkno Okno; private: System::Void MyForm_Load(System::Object^ sender, System::EventArgs^ e) { P.resize(10); for (int i = 0; i<10; i++) P[i] = WK2(0.5*i, sin(0.5*i)); } private: System::Void pictureBox1_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) { Okno.Inicjuj(e); Okno.Czysc(); Okno.Siatka(); Okno.Osie(); Okno.Funkcja(sin); Okno.Punkty(P); Okno.Lamana(P); } private: System::Void pictureBox1_Resize(System::Object^ sender, System::EventArgs^ e) { pictureBox1->Invalidate(); } private: System::Void pictureBox1_MouseDown(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) { bool czyLewy = e->Button == System::Windows::Forms::MouseButtons::Left; Keys klawisz = Control::ModifierKeys; if (klawisz == Keys::Control) Okno.SkalaMouseDown(e); if (czyLewy == true && klawisz == Keys::Shift) Okno.ZmienPunkt(e->X, e->Y, 0, P); if (czyLewy == true && klawisz == Keys::Alt) Okno.UsunWstawPunkt(e->X, e->Y, P); pictureBox1->Invalidate(); } private: System::Void pictureBox1_MouseMove(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) { bool czyLewy = e->Button == System::Windows::Forms::MouseButtons::Left; Keys klawisz = Control::ModifierKeys; if (klawisz == Keys::Control) Okno.SkalaMouseMove(e); if (czyLewy == true && klawisz == Keys::Shift) Okno.ZmienPunkt(e->X, e->Y, 1, P); pictureBox1->Invalidate(); } }; }