Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "point.h"
- namespace WFA {
- using namespace System;
- using namespace System::ComponentModel;
- using namespace System::Collections;
- using namespace System::Windows::Forms;
- using namespace System::Data;
- using namespace System::Drawing;
- public ref class Form1 : public System::Windows::Forms::Form {
- public:
- Pointf* point;
- int i, j, k, countOfPair;
- Graphics^ graphic;
- Color^ color;
- Pen^ pen;
- Form1(void) {
- InitializeComponent();
- i = 0;
- color = gcnew Color();
- pen = gcnew Pen(color->Red);
- countOfPair = 10;
- graphic = pictureBox1->CreateGraphics();
- point = new Pointf[countOfPair];
- }
- private:
- System::Windows::Forms::ComboBox^ comboBox1;
- System::Windows::Forms::PictureBox^ pictureBox1;
- System::ComponentModel::Container^ component;
- protected:
- ~Form1() {
- if (component) {
- delete component;
- }
- }
- #pragma region Windows Form Designer generated code
- /// <summary>
- /// Требуемый метод для поддержки конструктора — не изменяйте
- /// содержимое этого метода с помощью редактора кода.
- /// </summary>
- void InitializeComponent(void) {
- this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
- this->comboBox1 = (gcnew System::Windows::Forms::ComboBox());
- (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->pictureBox1))->BeginInit();
- this->SuspendLayout();
- //
- // pictureBox1
- //
- this->pictureBox1->Location = System::Drawing::Point(12, 12);
- this->pictureBox1->Name = L"pictureBox1";
- this->pictureBox1->Size = System::Drawing::Size(179, 238);
- this->pictureBox1->TabIndex = 1;
- this->pictureBox1->TabStop = false;
- this->pictureBox1->MouseDown += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::pictureBox1_MouseDown);
- //
- // comboBox1
- //
- this->comboBox1->FormattingEnabled = true;
- this->comboBox1->Location = System::Drawing::Point(209, 12);
- this->comboBox1->Name = L"comboBox1";
- this->comboBox1->Size = System::Drawing::Size(63, 21);
- this->comboBox1->TabIndex = 2;
- this->comboBox1->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::comboBox1_SelectedIndexChanged);
- //
- // Form1
- //
- this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
- this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
- this->ClientSize = System::Drawing::Size(284, 262);
- this->Controls->Add(this->comboBox1);
- this->Controls->Add(this->pictureBox1);
- this->Name = L"Form1";
- this->Text = L"Form1";
- (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->pictureBox1))->EndInit();
- this->ResumeLayout(false);
- }
- #pragma endregion
- private:
- System::Void pictureBox1_MouseDown(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
- if (i < countOfPair * 2) {
- graphic->DrawEllipse(pen, e->X, e->Y, 3.0, 3.0);
- point[i].x = e->X;
- point[i].y = e->Y;
- if (i % 2 == 1) {
- graphic->DrawLine(pen, e->X, e->Y, point[i - 1].x, point[i - 1].y);
- }
- comboBox1->Items->Add(Convert::ToString(point[i].x) + " | " + Convert::ToString(point[i].y));
- i++;
- }
- }
- System::Void comboBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement