/SProjekt/Projekt/Form1.h
C Header | 1078 lines | 876 code | 83 blank | 119 comment | 60 complexity | a8f13e61d8fd7eacd05768168b335519 MD5 | raw file
- #pragma once
- #include<cstdlib>
- #include<string>
- #include<cmath>
- #include<sstream>
- #include<fstream>
- #include "Pomocky.h"
- #include<iostream>
- #include<stdio.h>
-
-
-
- namespace Projekt {
-
- 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;
-
- /// <summary>
- /// Summary for Form1
- /// </summary>
- public ref class Form1 : public System::Windows::Forms::Form
- {
- int usecka, krivka, Lciara, polygon,i,font,pfcii,kruznica,obluk,elipsa,eobluk,inpic;
- float polomer,suhol,duhol,polomer2;
- array<PointF, 1> ^body;
- Graphics ^grafika;
- Pen ^pero,^pravitko;
- private: System::Windows::Forms::ComboBox^ comboBox1;
- private: System::Windows::Forms::TextBox^ textBox1;
- private: System::Windows::Forms::Label^ label1;
- private: System::Windows::Forms::Button^ button1;
- private: System::Windows::Forms::Button^ button2;
- private: System::Windows::Forms::Button^ button3;
- private: System::Windows::Forms::Button^ button4;
- private: System::Windows::Forms::Button^ button5;
- private: System::Windows::Forms::Button^ button6;
- private: System::Windows::Forms::Button^ button7;
- private: System::Windows::Forms::Button^ button8;
- private: System::Windows::Forms::Button^ button9;
- private: System::Windows::Forms::Button^ button10;
- private: System::Windows::Forms::Button^ button11;
- private: System::Windows::Forms::Button^ button12;
- private: System::Windows::Forms::Button^ button13;
- private: System::Windows::Forms::Label^ label2;
- private: System::Windows::Forms::Label^ label3;
- private: System::Windows::Forms::Label^ label4;
- private: System::Windows::Forms::Button^ button14;
- private: System::Windows::Forms::PictureBox^ pictureBox2;
- private: System::Windows::Forms::Button^ button15;
- private: System::Windows::Forms::Label^ label5;
- private: System::Windows::Forms::TextBox^ textBox2;
- private: System::Windows::Forms::CheckBox^ checkBox1;
- private: System::Windows::Forms::CheckBox^ checkBox2;
- private: System::Windows::Forms::CheckBox^ checkBox3;
- private: System::Windows::Forms::ComboBox^ comboBox2;
- private: System::Windows::Forms::Label^ label6;
-
- private: System::Windows::Forms::Label^ label7;
- private: System::Windows::Forms::NumericUpDown^ numericUpDown1;
- private: System::Windows::Forms::Button^ button16;
-
-
- Pomocky perif;
- public:
- Form1(void)
- {
- InitializeComponent();
- usecka=krivka=Lciara=polygon=kruznica=obluk=elipsa=eobluk=i=0;
- body = gcnew array<PointF, 1>(20);
- grafika=pictureBox1->CreateGraphics();
- pero=gcnew Pen(Color::Black);
- pravitko=gcnew Pen(Color::White);
- pfcii=0;
- inpic=0;
-
- //
- //TODO: Add the constructor code here
- //
- }
-
-
- protected:
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- ~Form1()
- {
- if (components)
- {
- delete components;
- }
- }
- private: System::Windows::Forms::PictureBox^ pictureBox1;
- protected:
-
- private:
- /// <summary>
- /// Required designer variable.
- /// </summary>
- System::ComponentModel::Container ^components;
-
- #pragma region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- void InitializeComponent(void)
- {
- this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
- this->comboBox1 = (gcnew System::Windows::Forms::ComboBox());
- this->textBox1 = (gcnew System::Windows::Forms::TextBox());
- this->label1 = (gcnew System::Windows::Forms::Label());
- this->button1 = (gcnew System::Windows::Forms::Button());
- this->button2 = (gcnew System::Windows::Forms::Button());
- this->button3 = (gcnew System::Windows::Forms::Button());
- this->button4 = (gcnew System::Windows::Forms::Button());
- this->button5 = (gcnew System::Windows::Forms::Button());
- this->button6 = (gcnew System::Windows::Forms::Button());
- this->button7 = (gcnew System::Windows::Forms::Button());
- this->button8 = (gcnew System::Windows::Forms::Button());
- this->button9 = (gcnew System::Windows::Forms::Button());
- this->button10 = (gcnew System::Windows::Forms::Button());
- this->button11 = (gcnew System::Windows::Forms::Button());
- this->button12 = (gcnew System::Windows::Forms::Button());
- this->button13 = (gcnew System::Windows::Forms::Button());
- this->label2 = (gcnew System::Windows::Forms::Label());
- this->label3 = (gcnew System::Windows::Forms::Label());
- this->label4 = (gcnew System::Windows::Forms::Label());
- this->button14 = (gcnew System::Windows::Forms::Button());
- this->pictureBox2 = (gcnew System::Windows::Forms::PictureBox());
- this->button15 = (gcnew System::Windows::Forms::Button());
- this->label5 = (gcnew System::Windows::Forms::Label());
- this->textBox2 = (gcnew System::Windows::Forms::TextBox());
- this->checkBox1 = (gcnew System::Windows::Forms::CheckBox());
- this->checkBox2 = (gcnew System::Windows::Forms::CheckBox());
- this->checkBox3 = (gcnew System::Windows::Forms::CheckBox());
- this->comboBox2 = (gcnew System::Windows::Forms::ComboBox());
- this->label6 = (gcnew System::Windows::Forms::Label());
- this->label7 = (gcnew System::Windows::Forms::Label());
- this->numericUpDown1 = (gcnew System::Windows::Forms::NumericUpDown());
- this->button16 = (gcnew System::Windows::Forms::Button());
- (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->BeginInit();
- (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox2))->BeginInit();
- (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown1))->BeginInit();
- this->SuspendLayout();
- //
- // pictureBox1
- //
- this->pictureBox1->BackColor = System::Drawing::SystemColors::ControlLightLight;
- this->pictureBox1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle;
- this->pictureBox1->Location = System::Drawing::Point(131, 54);
- this->pictureBox1->Name = L"pictureBox1";
- this->pictureBox1->Size = System::Drawing::Size(100, 100);
- this->pictureBox1->TabIndex = 0;
- this->pictureBox1->TabStop = false;
- this->pictureBox1->Click += gcnew System::EventHandler(this, &Form1::pictureBox1_Click);
- this->pictureBox1->MouseLeave += gcnew System::EventHandler(this, &Form1::pictureBox1_MouseLeave);
- this->pictureBox1->MouseHover += gcnew System::EventHandler(this, &Form1::pictureBox1_MouseHover);
- this->pictureBox1->MouseMove += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::pictureBox1_MouseMove);
- //
- // comboBox1
- //
- this->comboBox1->FormattingEnabled = true;
- this->comboBox1->Items->AddRange(gcnew cli::array< System::Object^ >(4) {L"font1", L"font2", L"font3", L"font4"});
- this->comboBox1->Location = System::Drawing::Point(131, 25);
- this->comboBox1->Name = L"comboBox1";
- this->comboBox1->Size = System::Drawing::Size(121, 21);
- this->comboBox1->TabIndex = 1;
- this->comboBox1->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::comboBox1_SelectedIndexChanged);
- //
- // textBox1
- //
- this->textBox1->Location = System::Drawing::Point(247, 68);
- this->textBox1->Name = L"textBox1";
- this->textBox1->Size = System::Drawing::Size(57, 20);
- this->textBox1->TabIndex = 2;
- //
- // label1
- //
- this->label1->AutoSize = true;
- this->label1->Location = System::Drawing::Point(244, 52);
- this->label1->Name = L"label1";
- this->label1->Size = System::Drawing::Size(293, 13);
- this->label1->TabIndex = 3;
- this->label1->Text = L"Zadajte editovane pismeno a stlacte tlacidlo \"Zacat upravy\"";
- //
- // button1
- //
- this->button1->Location = System::Drawing::Point(321, 68);
- this->button1->Name = L"button1";
- this->button1->Size = System::Drawing::Size(89, 23);
- this->button1->TabIndex = 4;
- this->button1->Text = L"Zacat upravy";
- this->button1->UseVisualStyleBackColor = true;
- this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
- //
- // button2
- //
- this->button2->Location = System::Drawing::Point(247, 112);
- this->button2->Name = L"button2";
- this->button2->Size = System::Drawing::Size(100, 23);
- this->button2->TabIndex = 5;
- this->button2->Text = L"Ukoncit upravy";
- this->button2->UseVisualStyleBackColor = true;
- this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
- //
- // button3
- //
- this->button3->Location = System::Drawing::Point(4, 25);
- this->button3->Name = L"button3";
- this->button3->Size = System::Drawing::Size(75, 23);
- this->button3->TabIndex = 6;
- this->button3->Text = L"Usecka";
- this->button3->UseVisualStyleBackColor = true;
- this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
- //
- // button4
- //
- this->button4->Location = System::Drawing::Point(4, 54);
- this->button4->Name = L"button4";
- this->button4->Size = System::Drawing::Size(75, 23);
- this->button4->TabIndex = 7;
- this->button4->Text = L"Lom. ciara";
- this->button4->UseVisualStyleBackColor = true;
- this->button4->Click += gcnew System::EventHandler(this, &Form1::button4_Click);
- //
- // button5
- //
- this->button5->Location = System::Drawing::Point(4, 83);
- this->button5->Name = L"button5";
- this->button5->Size = System::Drawing::Size(75, 23);
- this->button5->TabIndex = 8;
- this->button5->Text = L"Polygon";
- this->button5->UseVisualStyleBackColor = true;
- this->button5->Click += gcnew System::EventHandler(this, &Form1::button5_Click);
- //
- // button6
- //
- this->button6->Location = System::Drawing::Point(4, 113);
- this->button6->Name = L"button6";
- this->button6->Size = System::Drawing::Size(75, 23);
- this->button6->TabIndex = 9;
- this->button6->Text = L"Kruznica";
- this->button6->UseVisualStyleBackColor = true;
- this->button6->Click += gcnew System::EventHandler(this, &Form1::button6_Click);
- //
- // button7
- //
- this->button7->Location = System::Drawing::Point(4, 142);
- this->button7->Name = L"button7";
- this->button7->Size = System::Drawing::Size(75, 23);
- this->button7->TabIndex = 10;
- this->button7->Text = L"Kruz. obluk";
- this->button7->UseVisualStyleBackColor = true;
- this->button7->Click += gcnew System::EventHandler(this, &Form1::button7_Click);
- //
- // button8
- //
- this->button8->Location = System::Drawing::Point(4, 171);
- this->button8->Name = L"button8";
- this->button8->Size = System::Drawing::Size(75, 23);
- this->button8->TabIndex = 11;
- this->button8->Text = L"Elipsa";
- this->button8->UseVisualStyleBackColor = true;
- this->button8->Click += gcnew System::EventHandler(this, &Form1::button8_Click);
- //
- // button9
- //
- this->button9->Location = System::Drawing::Point(4, 200);
- this->button9->Name = L"button9";
- this->button9->Size = System::Drawing::Size(75, 23);
- this->button9->TabIndex = 12;
- this->button9->Text = L"Elip. obluk";
- this->button9->UseVisualStyleBackColor = true;
- this->button9->Click += gcnew System::EventHandler(this, &Form1::button9_Click);
- //
- // button10
- //
- this->button10->Location = System::Drawing::Point(4, 230);
- this->button10->Name = L"button10";
- this->button10->Size = System::Drawing::Size(75, 23);
- this->button10->TabIndex = 13;
- this->button10->Text = L"Krivka";
- this->button10->UseVisualStyleBackColor = true;
- this->button10->Click += gcnew System::EventHandler(this, &Form1::button10_Click);
- //
- // button11
- //
- this->button11->Location = System::Drawing::Point(85, 54);
- this->button11->Name = L"button11";
- this->button11->Size = System::Drawing::Size(40, 23);
- this->button11->TabIndex = 14;
- this->button11->Text = L"OK";
- this->button11->UseVisualStyleBackColor = true;
- this->button11->Click += gcnew System::EventHandler(this, &Form1::button11_Click);
- //
- // button12
- //
- this->button12->Location = System::Drawing::Point(85, 83);
- this->button12->Name = L"button12";
- this->button12->Size = System::Drawing::Size(40, 23);
- this->button12->TabIndex = 15;
- this->button12->Text = L"OK";
- this->button12->UseVisualStyleBackColor = true;
- this->button12->Click += gcnew System::EventHandler(this, &Form1::button12_Click);
- //
- // button13
- //
- this->button13->Location = System::Drawing::Point(85, 230);
- this->button13->Name = L"button13";
- this->button13->Size = System::Drawing::Size(40, 23);
- this->button13->TabIndex = 16;
- this->button13->Text = L"OK";
- this->button13->UseVisualStyleBackColor = true;
- this->button13->Click += gcnew System::EventHandler(this, &Form1::button13_Click);
- //
- // label2
- //
- this->label2->AutoSize = true;
- this->label2->Location = System::Drawing::Point(131, 161);
- this->label2->Name = L"label2";
- this->label2->Size = System::Drawing::Size(13, 13);
- this->label2->TabIndex = 17;
- this->label2->Text = L"0";
- //
- // label3
- //
- this->label3->AutoSize = true;
- this->label3->Location = System::Drawing::Point(150, 161);
- this->label3->Name = L"label3";
- this->label3->Size = System::Drawing::Size(10, 13);
- this->label3->TabIndex = 18;
- this->label3->Text = L":";
- //
- // label4
- //
- this->label4->AutoSize = true;
- this->label4->Location = System::Drawing::Point(166, 161);
- this->label4->Name = L"label4";
- this->label4->Size = System::Drawing::Size(13, 13);
- this->label4->TabIndex = 19;
- this->label4->Text = L"0";
- //
- // button14
- //
- this->button14->Location = System::Drawing::Point(205, 171);
- this->button14->Name = L"button14";
- this->button14->Size = System::Drawing::Size(75, 23);
- this->button14->TabIndex = 20;
- this->button14->Text = L"pravitko";
- this->button14->UseVisualStyleBackColor = true;
- this->button14->Click += gcnew System::EventHandler(this, &Form1::button14_Click);
- //
- // pictureBox2
- //
- this->pictureBox2->BackColor = System::Drawing::SystemColors::ButtonHighlight;
- this->pictureBox2->Location = System::Drawing::Point(285, 171);
- this->pictureBox2->Name = L"pictureBox2";
- this->pictureBox2->Size = System::Drawing::Size(700, 200);
- this->pictureBox2->TabIndex = 21;
- this->pictureBox2->TabStop = false;
- //
- // button15
- //
- this->button15->Location = System::Drawing::Point(853, 113);
- this->button15->Name = L"button15";
- this->button15->Size = System::Drawing::Size(131, 43);
- this->button15->TabIndex = 22;
- this->button15->Text = L"vypis text";
- this->button15->UseVisualStyleBackColor = true;
- this->button15->Click += gcnew System::EventHandler(this, &Form1::button15_Click);
- //
- // label5
- //
- this->label5->AutoSize = true;
- this->label5->Location = System::Drawing::Point(394, 113);
- this->label5->Name = L"label5";
- this->label5->Size = System::Drawing::Size(61, 13);
- this->label5->TabIndex = 23;
- this->label5->Text = L"zadajte text";
- //
- // textBox2
- //
- this->textBox2->Location = System::Drawing::Point(397, 136);
- this->textBox2->Name = L"textBox2";
- this->textBox2->Size = System::Drawing::Size(450, 20);
- this->textBox2->TabIndex = 24;
- //
- // checkBox1
- //
- this->checkBox1->AutoSize = true;
- this->checkBox1->Location = System::Drawing::Point(853, 27);
- this->checkBox1->Name = L"checkBox1";
- this->checkBox1->Size = System::Drawing::Size(48, 17);
- this->checkBox1->TabIndex = 25;
- this->checkBox1->Text = L"Italic";
- this->checkBox1->UseVisualStyleBackColor = true;
- //
- // checkBox2
- //
- this->checkBox2->AutoSize = true;
- this->checkBox2->Location = System::Drawing::Point(853, 50);
- this->checkBox2->Name = L"checkBox2";
- this->checkBox2->Size = System::Drawing::Size(47, 17);
- this->checkBox2->TabIndex = 26;
- this->checkBox2->Text = L"Bold";
- this->checkBox2->UseVisualStyleBackColor = true;
- //
- // checkBox3
- //
- this->checkBox3->AutoSize = true;
- this->checkBox3->Location = System::Drawing::Point(853, 71);
- this->checkBox3->Name = L"checkBox3";
- this->checkBox3->Size = System::Drawing::Size(71, 17);
- this->checkBox3->TabIndex = 27;
- this->checkBox3->Text = L"Underline";
- this->checkBox3->UseVisualStyleBackColor = true;
- //
- // comboBox2
- //
- this->comboBox2->FormattingEnabled = true;
- this->comboBox2->Items->AddRange(gcnew cli::array< System::Object^ >(4) {L"font1", L"font2", L"font3", L"font4"});
- this->comboBox2->Location = System::Drawing::Point(663, 44);
- this->comboBox2->Name = L"comboBox2";
- this->comboBox2->Size = System::Drawing::Size(107, 21);
- this->comboBox2->TabIndex = 28;
- //
- // label6
- //
- this->label6->AutoSize = true;
- this->label6->Location = System::Drawing::Point(660, 25);
- this->label6->Name = L"label6";
- this->label6->Size = System::Drawing::Size(187, 13);
- this->label6->TabIndex = 29;
- this->label6->Text = L"zvolte font ktorym chcete vykreslit text";
- //
- // label7
- //
- this->label7->AutoSize = true;
- this->label7->Location = System::Drawing::Point(660, 75);
- this->label7->Name = L"label7";
- this->label7->Size = System::Drawing::Size(71, 13);
- this->label7->TabIndex = 32;
- this->label7->Text = L"velkost pisma";
- //
- // numericUpDown1
- //
- this->numericUpDown1->Increment = System::Decimal(gcnew cli::array< System::Int32 >(4) {2, 0, 0, 0});
- this->numericUpDown1->Location = System::Drawing::Point(663, 106);
- this->numericUpDown1->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {70, 0, 0, 0});
- this->numericUpDown1->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {30, 0, 0, 0});
- this->numericUpDown1->Name = L"numericUpDown1";
- this->numericUpDown1->Size = System::Drawing::Size(120, 20);
- this->numericUpDown1->TabIndex = 33;
- this->numericUpDown1->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {30, 0, 0, 0});
- this->numericUpDown1->ValueChanged += gcnew System::EventHandler(this, &Form1::numericUpDown1_ValueChanged);
- //
- // button16
- //
- this->button16->Location = System::Drawing::Point(551, 25);
- this->button16->Name = L"button16";
- this->button16->Size = System::Drawing::Size(85, 29);
- this->button16->TabIndex = 34;
- this->button16->Text = L"farba";
- this->button16->UseVisualStyleBackColor = true;
- this->button16->Click += gcnew System::EventHandler(this, &Form1::button16_Click);
- //
- // Form1
- //
- this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
- this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
- this->ClientSize = System::Drawing::Size(1000, 374);
- this->Controls->Add(this->button16);
- this->Controls->Add(this->numericUpDown1);
- this->Controls->Add(this->label7);
- this->Controls->Add(this->label6);
- this->Controls->Add(this->comboBox2);
- this->Controls->Add(this->checkBox3);
- this->Controls->Add(this->checkBox2);
- this->Controls->Add(this->checkBox1);
- this->Controls->Add(this->textBox2);
- this->Controls->Add(this->label5);
- this->Controls->Add(this->button15);
- this->Controls->Add(this->pictureBox2);
- this->Controls->Add(this->button14);
- this->Controls->Add(this->label4);
- this->Controls->Add(this->label3);
- this->Controls->Add(this->label2);
- this->Controls->Add(this->button13);
- this->Controls->Add(this->button12);
- this->Controls->Add(this->button11);
- this->Controls->Add(this->button10);
- this->Controls->Add(this->button9);
- this->Controls->Add(this->button8);
- this->Controls->Add(this->button7);
- this->Controls->Add(this->button6);
- this->Controls->Add(this->button5);
- this->Controls->Add(this->button4);
- this->Controls->Add(this->button3);
- this->Controls->Add(this->button2);
- this->Controls->Add(this->button1);
- this->Controls->Add(this->label1);
- this->Controls->Add(this->textBox1);
- 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();
- (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox2))->EndInit();
- (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown1))->EndInit();
- this->ResumeLayout(false);
- this->PerformLayout();
-
- }
- void Vypni()
- {
- usecka=Lciara=polygon=kruznica=obluk=elipsa=eobluk=krivka=i=0;
- }
- #pragma endregion
- private: System::Void pictureBox1_Click(System::Object^ sender, System::EventArgs^ e) {
-
- PointF help;
- string pomoc;
- help = pictureBox1->PointToClient(pictureBox1->MousePosition);
-
- body[i].X=help.X;
- body[i].Y=help.Y;
-
- grafika->DrawRectangle(pero,help.X,help.Y,1.,1.);
-
- if(usecka)
- if(i==1)
- {
- grafika->DrawLine(pero, body[0].X,body[0].Y,body[1].X,body[1].Y);
- Vypni();
- fstream subor;
- subor.open(perif.nazov(),fstream::out | fstream::app);
- subor<<body[0].X<<endl<<body[0].Y<<endl<<body[1].X<<endl<<body[1].Y<<endl;
- subor.close();
- }
-
- if (Lciara)
- {
- if (i>=1)
- {
- grafika->DrawLine(pero,body[i].X,body[i].Y,body[i-1].X,body[i-1].Y);
- }
- }
-
- if (polygon)
- {
- if (i>=1)
- {
- for (int j = 0; j < i; j++)
- {
- grafika->DrawLine(pero,body[j],body[j+1]);
- }
- }
-
- }
-
- if (kruznica)
- {
- if (i==1)
- {
- polomer=sqrt( pow(body[1].X-body[0].X,2) + pow(body[1].Y - body[0].Y,2) );
- grafika->DrawEllipse(pero,body[0].X-polomer,body[0].Y-polomer,2*polomer,2*polomer);
-
- fstream subor;
- subor.open(perif.nazov(),fstream::out | fstream::app);
- subor<<body[0].X<<endl<<body[0].Y<<endl<<polomer<<endl;
- Vypni();
- }
- }
-
- if (obluk)
- {
- if (i==2)
- {
- polomer=sqrt( pow(body[1].X-body[0].X,2) + pow(body[1].Y - body[0].Y,2) );
- suhol=acos( (body[1].X-body[0].X)/polomer)*(180/3.14);
- if(body[0].Y>body[1].Y)
- suhol=360-suhol;
- duhol=acos( ((body[2].X-body[0].X)*(body[1].X-body[0].X)+(body[2].Y-body[0].Y)*(body[1].Y-body[0].Y))/polomer/polomer)*(180/3.14);
- grafika->DrawArc(pero,body[0].X-polomer,body[0].Y-polomer,2*polomer,2*polomer,suhol,duhol);
-
- fstream subor;
- subor.open(perif.nazov(),fstream::out | fstream::app);
- subor<<body[0].X<<endl<<body[0].Y<<endl<<polomer<<endl<<suhol<<endl<<duhol<<endl;
- Vypni();
- }
- }
-
- if (elipsa)
- {
- if (i==2)
- {
- polomer=sqrt( pow(body[1].X-body[0].X,2) + pow(body[1].Y - body[0].Y,2) );
- polomer2=sqrt( pow(body[2].X-body[0].X,2) + pow(body[2].Y - body[0].Y,2) );
- grafika->DrawEllipse(pero,body[0].X-polomer,body[0].Y-polomer2,2*polomer,2*polomer2);
-
- fstream subor;
- subor.open(perif.nazov(),fstream::out | fstream::app);
- subor<<body[0].X<<endl<<body[0].Y<<endl<<polomer<<endl<<polomer2<<endl;
- Vypni();
- }
- }
-
- if (eobluk)
- {
- if (i==4)
- {
- polomer=sqrt( pow(body[3].X-body[0].X,2) + pow(body[3].Y - body[0].Y,2) );
- polomer2=sqrt( pow(body[4].X-body[0].X,2) + pow(body[4].Y - body[0].Y,2) );
- suhol=acos( (body[3].X-body[0].X)/polomer)*(180/3.14);
- if(body[0].Y>body[3].Y)
- suhol=360-suhol;
- duhol=acos( ((body[3].X-body[0].X)*(body[4].X-body[0].X)+(body[3].Y-body[0].Y)*(body[4].Y-body[0].Y))/polomer/polomer2)*(180/3.14);
- grafika->DrawArc(pero,body[0].X-polomer,body[0].Y-polomer2,2*polomer,2*polomer2,suhol,duhol);
-
- fstream subor;
- subor.open(perif.nazov(),fstream::out | fstream::app);
- subor<<body[0].X<<endl<<body[0].Y<<endl<<polomer<<endl<<polomer2<<endl<<suhol<<endl<<duhol<<endl;
- Vypni();
- }
- }
- if (krivka)
- {
- if (i==0)
- {
- body[1]=body[0];
- i++;
- body[2]=body[0];
- i++;
- body[3]=body[0];
- i++;
- }
- }
- i++;
- }
-
- private: System::Void comboBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
-
- font=comboBox1->SelectedIndex;
- }
- private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
-
- string pomoc;
- stringstream help;
- help<<font+1;
- help>>pomoc;
- pomoc+=perif.StringNastring(textBox1->Text);
- pomoc+=".txt";
- perif.uloz_nazov(pomoc);
- }
-
- private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
-
- Vypni();
- usecka=1;
- fstream subor(perif.nazov(),fstream::out | fstream::app);
- subor<<"Line"<<endl;
- subor.close();
- }
- private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
-
- Vypni();
- Lciara=1;
- fstream subor(perif.nazov(),fstream::out | fstream::app);
- subor<<"LLine"<<endl;
- subor.close();
- }
- private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) {
-
- Vypni();
- polygon=1;
- fstream subor(perif.nazov(),fstream::out | fstream::app);
- subor<<"Polyg"<<endl;
- subor.close();
- }
- private: System::Void button6_Click(System::Object^ sender, System::EventArgs^ e) {
-
- Vypni();
- kruznica=1;
- fstream subor(perif.nazov(),fstream::out | fstream::app);
- subor<<"Circle"<<endl;
- subor.close();
- }
- private: System::Void button7_Click(System::Object^ sender, System::EventArgs^ e) {
-
- Vypni();
- obluk=1;
- fstream subor(perif.nazov(),fstream::out | fstream::app);
- subor<<"CArc"<<endl;
- subor.close();
- }
- private: System::Void button8_Click(System::Object^ sender, System::EventArgs^ e) {
-
- Vypni();
- elipsa=1;
- fstream subor(perif.nazov(),fstream::out | fstream::app);
- subor<<"Ellipse"<<endl;
- subor.close();
- }
- private: System::Void button9_Click(System::Object^ sender, System::EventArgs^ e) {
-
- Vypni();
- eobluk=1;
- fstream subor(perif.nazov(),fstream::out | fstream::app);
- subor<<"EllArc"<<endl;
- subor.close();
- }
- private: System::Void button10_Click(System::Object^ sender, System::EventArgs^ e) {
-
- Vypni();
- krivka=1;
- fstream subor(perif.nazov(),fstream::out | fstream::app);
- subor<<"Curve"<<endl;
- subor.close();
- }
- private: System::Void button11_Click(System::Object^ sender, System::EventArgs^ e) {
-
- if(Lciara)
- {
- fstream subor;
- subor.open(perif.nazov(),fstream::out | fstream::app);
- subor<<i<<endl;
- for (int j = 0; j < i; j++)
- {
- subor<<body[j].X/10.0<<endl<<body[j].Y/10.0<<endl;
- }
- Vypni();
- }
- }
- private: System::Void button12_Click(System::Object^ sender, System::EventArgs^ e) {
-
- if (polygon)
- {
- grafika->DrawLine(pero,body[0],body[i-1]);
- fstream subor;
- subor.open(perif.nazov(),fstream::out | fstream::app);
- subor<<i<<endl;
- for (int j = 0; j < i; j++)
- {
- subor<<body[j].X/10.0<<endl<<body[j].Y/10.0<<endl;
- }
- Vypni();
- }
- }
- private: System::Void button13_Click(System::Object^ sender, System::EventArgs^ e) {
-
- if (krivka)
- {
- body[i]=body[i-1];
- i++;
- body[i]=body[i-2];
- i++;
- float px,py;
- px=py=0;
- for (int k = 0; k < i-3; k++)
- {
- for (float t = 0; t <= 1; t+=0.05)
- {
- px=(-(1./6.)*t*t*t + (1./2.)*t*t -(1./2.)*t + (1./6.))*body[k].X + ((1./2.)*t*t*t - t*t + (2./3.))*body[k+1].X + (-(1./2.)*t*t*t + (1./2.)*t*t + (1./2.)*t + (1./6.))*body[k+2].X + (1./6.)*t*t*t*body[k+3].X;
- py=(-(1./6.)*t*t*t + (1./2.)*t*t -(1./2.)*t + (1./6.))*body[k].Y + ((1./2.)*t*t*t - t*t + (2./3.))*body[k+1].Y + (-(1./2.)*t*t*t + (1./2.)*t*t + (1./2.)*t + (1./6.))*body[k+2].Y + (1./6.)*t*t*t*body[k+3].Y;
-
- grafika->DrawRectangle(pero,px,py,1.,1.);
- }
- }
-
- fstream subor;
- subor.open(perif.nazov(),fstream::out | fstream::app);
- subor<<i<<endl;
- for (int j = 0; j < i; j++)
- {
- subor<<body[j].X<<endl<<body[j].Y<<endl;
- }
- Vypni();
- }
- }
-
- private: System::Void pictureBox1_MouseHover(System::Object^ sender, System::EventArgs^ e) {
-
- inpic=1;
- }
-
- private: System::Void pictureBox1_MouseMove(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
- Point help;
- help = pictureBox1->PointToClient(pictureBox1->MousePosition);
- if(inpic)
- {
- label2->Text=Convert::ToString(help.X);
- label4->Text=Convert::ToString(help.Y);
- }
-
- }
-
- private: System::Void pictureBox1_MouseLeave(System::Object^ sender, System::EventArgs^ e) {
- inpic=0;
- }
-
- private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
-
- grafika->Clear(Color::White);
- }
-
- private: System::Void button14_Click(System::Object^ sender, System::EventArgs^ e) {
-
- if(pravitko->Color==Color::Black)
- {
- pravitko->Color=Color::White;
- grafika->DrawLine(pravitko,1,1,1,99);
- grafika->DrawLine(pravitko,1,1,99,1);
- for (int p = 0; p <= 100; p+=10)
- {
- grafika->DrawLine(pravitko,0,p,2,p);
- grafika->DrawLine(pravitko,p,0,p,2);
- }
- pravitko->Color=Color::Black;
- }
-
- if(pravitko->Color==Color::White)
- {
- pravitko->Color=Color::Black;
- grafika->DrawLine(pravitko,1,1,1,99);
- grafika->DrawLine(pravitko,1,1,99,1);
- for (int p = 0; p <= 100; p+=10)
- {
- grafika->DrawLine(pravitko,0,p,2,p);
- grafika->DrawLine(pravitko,p,0,p,2);
- }
- pravitko->Color=Color::White;
- }
-
- if (pravitko->Color==Color::White)
- {
- pravitko->Color=Color::Black;
- }
- else
- {
- pravitko->Color=Color::White;
- }
-
- }
-
- public: static float velkost=0.3;
-
- private: System::Void button15_Click(System::Object^ sender, System::EventArgs^ e)
- {
- Graphics^grafika2=pictureBox2->CreateGraphics();
- grafika2->Clear(Color::White);
-
- fstream subor;
- string text,typ,juhu=" ";
- String ^pom;
- float temp,r,r2,s,d;
- int l,i,j=0,posunx=0,posuny=0;
- char font_meno[6];
- const char *chtext;
- pom=textBox2->Text;
- text=perif.StringNastring(pom);
- chtext=(const char*)text.c_str();
-
- if(checkBox2->Checked)
- pero->Width=5;
- else
- pero->Width=1;
-
-
- //chtext->Length();
- while(true)
- {
- if(chtext[j]!=0)
- {
- {
- if(chtext[j]==' ')
- {
- posunx+=100*(2*velkost);
- j++;
- if(posunx>=700)
- {
- posunx=0;
- posuny+=100*(2*velkost);
- }
- }
- else
- {
- sprintf(font_meno,"%d%c.txt",(int(comboBox2->SelectedIndex)+1),chtext[j]);
- subor.open(font_meno,fstream::in);
- j++;
-
- if(subor.is_open())
- {
- subor.close();
- subor.open(font_meno,fstream::in);
-
- while(!subor.eof())
- {
- if(juhu==" ")
- subor>>typ;
- else
- typ=juhu;
-
- if(typ=="Line")
- {
- subor>>temp;
- body[0].X=(temp+posunx)*velkost;
- subor>>temp;
- body[0].Y=(temp+posuny)*velkost;
- subor>>temp;
- body[1].X=(temp+posunx)*velkost;
- subor>>temp;
- body[1].Y=(temp+posuny)*velkost;
- grafika2->DrawLine(pero,body[0],body[1]);
- }
- else
- if(typ=="Polyg")
- {
- subor>>l;
- array<PointF>^ polpoint=gcnew array <PointF>(l);
- for(i=0;i<l;i++)
- {
- subor>>temp;
- polpoint[i].X=(temp*10+posunx)*velkost;
- subor>>temp;
- polpoint[i].Y=(temp*10+posuny)*velkost;
- }
- for(i=0;i<l-1;i++)
- {
- grafika2->DrawLine(pero,polpoint[i],polpoint[i+1]);
- }
- grafika2->DrawLine(pero,polpoint[0],polpoint[l-1]);
-
- }
-
- else
- if(typ=="LLine")
- {
- subor>>l;
- array<PointF>^ polpoint=gcnew array <PointF>(l);
- for(i=0;i<l;i++)
- {
- subor>>temp;
- polpoint[i].X=(temp*10+posunx)*velkost;
- subor>>temp;
- polpoint[i].Y=(temp*10+posuny)*velkost;
- }
- for(i=0;i<l-1;i++)
- {
- grafika2->DrawLine(pero,polpoint[i],polpoint[i+1]);
- }
-
- }
-
- else
- if(typ=="Circle")
- {
- subor>>temp;
- body[0].X=(temp+posunx)*velkost;
- subor>>temp;
- body[0].Y=(temp+posuny)*velkost;
- subor>>r;
- r=r*velkost;
- grafika2->DrawEllipse(pero,body[0].X-r,body[0].Y-r,r*2,r*2);
- subor>>juhu;
- if(juhu==" ")
- break;
- }
-
- else
- if(typ=="CArc")
- {
- subor>>temp;
- body[0].X=(temp+posunx)*velkost;
- subor>>temp;
- body[0].Y=(temp+posuny)*velkost;
- subor>>r;
- subor>>s;
- subor>>d;
- r=r*velkost;
- s=s*velkost;
- d=d*velkost;
- grafika2->DrawArc(pero,body[0].X-r,body[0].Y-r,2*r,2*r,s,d);
- subor>>juhu;
- if(juhu==" ")
- break;
- }
-
- else
- if(typ=="Ellipse")
- {
- subor>>temp;
- body[0].X=(temp+posunx)*velkost;
- subor>>temp;
- body[0].Y=(temp+posuny)*velkost;
- subor>>r;
- subor>>r2;
- r=r*velkost;
- r2=r2*velkost;
- grafika2->DrawEllipse(pero,body[0].X-r,body[0].Y-r2,2*r,2*r2);
- subor>>juhu;
- if(juhu==" ")
- break;
- }
-
- else
- if(typ=="EllArc")
- {
- subor>>temp;
- body[0].X=(temp+posunx)*velkost;
- subor>>temp;
- body[0].Y=(temp+posuny)*velkost;
- subor>>r;
- subor>>r2;
- subor>>s;
- subor>>d;
- r=r*velkost;
- r2=r2*velkost;
- s=s*velkost;
- d=d*velkost;
- grafika2->DrawArc(pero,body[0].X-r,body[0].Y-r2,2*r,2*r2,s,d);
- subor>>juhu;
- if(juhu==" ")
- break;
- }
-
- else
- if(typ=="Curve")
- {
- subor>>l;
- array<PointF>^ cpoint=gcnew array <PointF>(l);
- for(i=0;i<l;i++)
- {
- subor>>temp;
- cpoint[i].X=(temp+posunx)*velkost;
- subor>>temp;
- cpoint[i].Y=(temp+posuny)*velkost;
- }
- grafika2->DrawCurve(pero,cpoint);
- }
-
- }
- }
- posunx+=100*(2*velkost);
- }
- }}
- else
- break;
- }
-
- if(checkBox3->Checked)
- grafika2->DrawLine(pero,0,int(100*velkost+posuny),int((posunx+100)*velkost),int(100*velkost+posuny));
- }
-
- private: System::Void numericUpDown1_ValueChanged(System::Object^ sender, System::EventArgs^ e)
- {
- velkost=(float)numericUpDown1->Value/100;
- }
- private: System::Void button16_Click(System::Object^ sender, System::EventArgs^ e)
- {
- ColorDialog^MyDialog= gcnew ColorDialog();
-
- MyDialog->AllowFullOpen=true;
-
- MyDialog->ShowHelp=true;
- if(MyDialog->ShowDialog()==::System::Windows::Forms::DialogResult::OK)
- pero->Color=MyDialog->Color;
-
-
- }
- };
- }
-