PageRenderTime 47ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/SProjekt/Projekt/Form1.h

https://bitbucket.org/xjuhasova/projekt
C Header | 1078 lines | 876 code | 83 blank | 119 comment | 60 complexity | a8f13e61d8fd7eacd05768168b335519 MD5 | raw file
  1. #pragma once
  2. #include<cstdlib>
  3. #include<string>
  4. #include<cmath>
  5. #include<sstream>
  6. #include<fstream>
  7. #include "Pomocky.h"
  8. #include<iostream>
  9. #include<stdio.h>
  10. namespace Projekt {
  11. using namespace System;
  12. using namespace System::ComponentModel;
  13. using namespace System::Collections;
  14. using namespace System::Windows::Forms;
  15. using namespace System::Data;
  16. using namespace System::Drawing;
  17. using namespace std;
  18. /// <summary>
  19. /// Summary for Form1
  20. /// </summary>
  21. public ref class Form1 : public System::Windows::Forms::Form
  22. {
  23. int usecka, krivka, Lciara, polygon,i,font,pfcii,kruznica,obluk,elipsa,eobluk,inpic;
  24. float polomer,suhol,duhol,polomer2;
  25. array<PointF, 1> ^body;
  26. Graphics ^grafika;
  27. Pen ^pero,^pravitko;
  28. private: System::Windows::Forms::ComboBox^ comboBox1;
  29. private: System::Windows::Forms::TextBox^ textBox1;
  30. private: System::Windows::Forms::Label^ label1;
  31. private: System::Windows::Forms::Button^ button1;
  32. private: System::Windows::Forms::Button^ button2;
  33. private: System::Windows::Forms::Button^ button3;
  34. private: System::Windows::Forms::Button^ button4;
  35. private: System::Windows::Forms::Button^ button5;
  36. private: System::Windows::Forms::Button^ button6;
  37. private: System::Windows::Forms::Button^ button7;
  38. private: System::Windows::Forms::Button^ button8;
  39. private: System::Windows::Forms::Button^ button9;
  40. private: System::Windows::Forms::Button^ button10;
  41. private: System::Windows::Forms::Button^ button11;
  42. private: System::Windows::Forms::Button^ button12;
  43. private: System::Windows::Forms::Button^ button13;
  44. private: System::Windows::Forms::Label^ label2;
  45. private: System::Windows::Forms::Label^ label3;
  46. private: System::Windows::Forms::Label^ label4;
  47. private: System::Windows::Forms::Button^ button14;
  48. private: System::Windows::Forms::PictureBox^ pictureBox2;
  49. private: System::Windows::Forms::Button^ button15;
  50. private: System::Windows::Forms::Label^ label5;
  51. private: System::Windows::Forms::TextBox^ textBox2;
  52. private: System::Windows::Forms::CheckBox^ checkBox1;
  53. private: System::Windows::Forms::CheckBox^ checkBox2;
  54. private: System::Windows::Forms::CheckBox^ checkBox3;
  55. private: System::Windows::Forms::ComboBox^ comboBox2;
  56. private: System::Windows::Forms::Label^ label6;
  57. private: System::Windows::Forms::Label^ label7;
  58. private: System::Windows::Forms::NumericUpDown^ numericUpDown1;
  59. private: System::Windows::Forms::Button^ button16;
  60. Pomocky perif;
  61. public:
  62. Form1(void)
  63. {
  64. InitializeComponent();
  65. usecka=krivka=Lciara=polygon=kruznica=obluk=elipsa=eobluk=i=0;
  66. body = gcnew array<PointF, 1>(20);
  67. grafika=pictureBox1->CreateGraphics();
  68. pero=gcnew Pen(Color::Black);
  69. pravitko=gcnew Pen(Color::White);
  70. pfcii=0;
  71. inpic=0;
  72. //
  73. //TODO: Add the constructor code here
  74. //
  75. }
  76. protected:
  77. /// <summary>
  78. /// Clean up any resources being used.
  79. /// </summary>
  80. ~Form1()
  81. {
  82. if (components)
  83. {
  84. delete components;
  85. }
  86. }
  87. private: System::Windows::Forms::PictureBox^ pictureBox1;
  88. protected:
  89. private:
  90. /// <summary>
  91. /// Required designer variable.
  92. /// </summary>
  93. System::ComponentModel::Container ^components;
  94. #pragma region Windows Form Designer generated code
  95. /// <summary>
  96. /// Required method for Designer support - do not modify
  97. /// the contents of this method with the code editor.
  98. /// </summary>
  99. void InitializeComponent(void)
  100. {
  101. this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
  102. this->comboBox1 = (gcnew System::Windows::Forms::ComboBox());
  103. this->textBox1 = (gcnew System::Windows::Forms::TextBox());
  104. this->label1 = (gcnew System::Windows::Forms::Label());
  105. this->button1 = (gcnew System::Windows::Forms::Button());
  106. this->button2 = (gcnew System::Windows::Forms::Button());
  107. this->button3 = (gcnew System::Windows::Forms::Button());
  108. this->button4 = (gcnew System::Windows::Forms::Button());
  109. this->button5 = (gcnew System::Windows::Forms::Button());
  110. this->button6 = (gcnew System::Windows::Forms::Button());
  111. this->button7 = (gcnew System::Windows::Forms::Button());
  112. this->button8 = (gcnew System::Windows::Forms::Button());
  113. this->button9 = (gcnew System::Windows::Forms::Button());
  114. this->button10 = (gcnew System::Windows::Forms::Button());
  115. this->button11 = (gcnew System::Windows::Forms::Button());
  116. this->button12 = (gcnew System::Windows::Forms::Button());
  117. this->button13 = (gcnew System::Windows::Forms::Button());
  118. this->label2 = (gcnew System::Windows::Forms::Label());
  119. this->label3 = (gcnew System::Windows::Forms::Label());
  120. this->label4 = (gcnew System::Windows::Forms::Label());
  121. this->button14 = (gcnew System::Windows::Forms::Button());
  122. this->pictureBox2 = (gcnew System::Windows::Forms::PictureBox());
  123. this->button15 = (gcnew System::Windows::Forms::Button());
  124. this->label5 = (gcnew System::Windows::Forms::Label());
  125. this->textBox2 = (gcnew System::Windows::Forms::TextBox());
  126. this->checkBox1 = (gcnew System::Windows::Forms::CheckBox());
  127. this->checkBox2 = (gcnew System::Windows::Forms::CheckBox());
  128. this->checkBox3 = (gcnew System::Windows::Forms::CheckBox());
  129. this->comboBox2 = (gcnew System::Windows::Forms::ComboBox());
  130. this->label6 = (gcnew System::Windows::Forms::Label());
  131. this->label7 = (gcnew System::Windows::Forms::Label());
  132. this->numericUpDown1 = (gcnew System::Windows::Forms::NumericUpDown());
  133. this->button16 = (gcnew System::Windows::Forms::Button());
  134. (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->BeginInit();
  135. (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox2))->BeginInit();
  136. (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown1))->BeginInit();
  137. this->SuspendLayout();
  138. //
  139. // pictureBox1
  140. //
  141. this->pictureBox1->BackColor = System::Drawing::SystemColors::ControlLightLight;
  142. this->pictureBox1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle;
  143. this->pictureBox1->Location = System::Drawing::Point(131, 54);
  144. this->pictureBox1->Name = L"pictureBox1";
  145. this->pictureBox1->Size = System::Drawing::Size(100, 100);
  146. this->pictureBox1->TabIndex = 0;
  147. this->pictureBox1->TabStop = false;
  148. this->pictureBox1->Click += gcnew System::EventHandler(this, &Form1::pictureBox1_Click);
  149. this->pictureBox1->MouseLeave += gcnew System::EventHandler(this, &Form1::pictureBox1_MouseLeave);
  150. this->pictureBox1->MouseHover += gcnew System::EventHandler(this, &Form1::pictureBox1_MouseHover);
  151. this->pictureBox1->MouseMove += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::pictureBox1_MouseMove);
  152. //
  153. // comboBox1
  154. //
  155. this->comboBox1->FormattingEnabled = true;
  156. this->comboBox1->Items->AddRange(gcnew cli::array< System::Object^ >(4) {L"font1", L"font2", L"font3", L"font4"});
  157. this->comboBox1->Location = System::Drawing::Point(131, 25);
  158. this->comboBox1->Name = L"comboBox1";
  159. this->comboBox1->Size = System::Drawing::Size(121, 21);
  160. this->comboBox1->TabIndex = 1;
  161. this->comboBox1->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::comboBox1_SelectedIndexChanged);
  162. //
  163. // textBox1
  164. //
  165. this->textBox1->Location = System::Drawing::Point(247, 68);
  166. this->textBox1->Name = L"textBox1";
  167. this->textBox1->Size = System::Drawing::Size(57, 20);
  168. this->textBox1->TabIndex = 2;
  169. //
  170. // label1
  171. //
  172. this->label1->AutoSize = true;
  173. this->label1->Location = System::Drawing::Point(244, 52);
  174. this->label1->Name = L"label1";
  175. this->label1->Size = System::Drawing::Size(293, 13);
  176. this->label1->TabIndex = 3;
  177. this->label1->Text = L"Zadajte editovane pismeno a stlacte tlacidlo \"Zacat upravy\"";
  178. //
  179. // button1
  180. //
  181. this->button1->Location = System::Drawing::Point(321, 68);
  182. this->button1->Name = L"button1";
  183. this->button1->Size = System::Drawing::Size(89, 23);
  184. this->button1->TabIndex = 4;
  185. this->button1->Text = L"Zacat upravy";
  186. this->button1->UseVisualStyleBackColor = true;
  187. this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
  188. //
  189. // button2
  190. //
  191. this->button2->Location = System::Drawing::Point(247, 112);
  192. this->button2->Name = L"button2";
  193. this->button2->Size = System::Drawing::Size(100, 23);
  194. this->button2->TabIndex = 5;
  195. this->button2->Text = L"Ukoncit upravy";
  196. this->button2->UseVisualStyleBackColor = true;
  197. this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
  198. //
  199. // button3
  200. //
  201. this->button3->Location = System::Drawing::Point(4, 25);
  202. this->button3->Name = L"button3";
  203. this->button3->Size = System::Drawing::Size(75, 23);
  204. this->button3->TabIndex = 6;
  205. this->button3->Text = L"Usecka";
  206. this->button3->UseVisualStyleBackColor = true;
  207. this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
  208. //
  209. // button4
  210. //
  211. this->button4->Location = System::Drawing::Point(4, 54);
  212. this->button4->Name = L"button4";
  213. this->button4->Size = System::Drawing::Size(75, 23);
  214. this->button4->TabIndex = 7;
  215. this->button4->Text = L"Lom. ciara";
  216. this->button4->UseVisualStyleBackColor = true;
  217. this->button4->Click += gcnew System::EventHandler(this, &Form1::button4_Click);
  218. //
  219. // button5
  220. //
  221. this->button5->Location = System::Drawing::Point(4, 83);
  222. this->button5->Name = L"button5";
  223. this->button5->Size = System::Drawing::Size(75, 23);
  224. this->button5->TabIndex = 8;
  225. this->button5->Text = L"Polygon";
  226. this->button5->UseVisualStyleBackColor = true;
  227. this->button5->Click += gcnew System::EventHandler(this, &Form1::button5_Click);
  228. //
  229. // button6
  230. //
  231. this->button6->Location = System::Drawing::Point(4, 113);
  232. this->button6->Name = L"button6";
  233. this->button6->Size = System::Drawing::Size(75, 23);
  234. this->button6->TabIndex = 9;
  235. this->button6->Text = L"Kruznica";
  236. this->button6->UseVisualStyleBackColor = true;
  237. this->button6->Click += gcnew System::EventHandler(this, &Form1::button6_Click);
  238. //
  239. // button7
  240. //
  241. this->button7->Location = System::Drawing::Point(4, 142);
  242. this->button7->Name = L"button7";
  243. this->button7->Size = System::Drawing::Size(75, 23);
  244. this->button7->TabIndex = 10;
  245. this->button7->Text = L"Kruz. obluk";
  246. this->button7->UseVisualStyleBackColor = true;
  247. this->button7->Click += gcnew System::EventHandler(this, &Form1::button7_Click);
  248. //
  249. // button8
  250. //
  251. this->button8->Location = System::Drawing::Point(4, 171);
  252. this->button8->Name = L"button8";
  253. this->button8->Size = System::Drawing::Size(75, 23);
  254. this->button8->TabIndex = 11;
  255. this->button8->Text = L"Elipsa";
  256. this->button8->UseVisualStyleBackColor = true;
  257. this->button8->Click += gcnew System::EventHandler(this, &Form1::button8_Click);
  258. //
  259. // button9
  260. //
  261. this->button9->Location = System::Drawing::Point(4, 200);
  262. this->button9->Name = L"button9";
  263. this->button9->Size = System::Drawing::Size(75, 23);
  264. this->button9->TabIndex = 12;
  265. this->button9->Text = L"Elip. obluk";
  266. this->button9->UseVisualStyleBackColor = true;
  267. this->button9->Click += gcnew System::EventHandler(this, &Form1::button9_Click);
  268. //
  269. // button10
  270. //
  271. this->button10->Location = System::Drawing::Point(4, 230);
  272. this->button10->Name = L"button10";
  273. this->button10->Size = System::Drawing::Size(75, 23);
  274. this->button10->TabIndex = 13;
  275. this->button10->Text = L"Krivka";
  276. this->button10->UseVisualStyleBackColor = true;
  277. this->button10->Click += gcnew System::EventHandler(this, &Form1::button10_Click);
  278. //
  279. // button11
  280. //
  281. this->button11->Location = System::Drawing::Point(85, 54);
  282. this->button11->Name = L"button11";
  283. this->button11->Size = System::Drawing::Size(40, 23);
  284. this->button11->TabIndex = 14;
  285. this->button11->Text = L"OK";
  286. this->button11->UseVisualStyleBackColor = true;
  287. this->button11->Click += gcnew System::EventHandler(this, &Form1::button11_Click);
  288. //
  289. // button12
  290. //
  291. this->button12->Location = System::Drawing::Point(85, 83);
  292. this->button12->Name = L"button12";
  293. this->button12->Size = System::Drawing::Size(40, 23);
  294. this->button12->TabIndex = 15;
  295. this->button12->Text = L"OK";
  296. this->button12->UseVisualStyleBackColor = true;
  297. this->button12->Click += gcnew System::EventHandler(this, &Form1::button12_Click);
  298. //
  299. // button13
  300. //
  301. this->button13->Location = System::Drawing::Point(85, 230);
  302. this->button13->Name = L"button13";
  303. this->button13->Size = System::Drawing::Size(40, 23);
  304. this->button13->TabIndex = 16;
  305. this->button13->Text = L"OK";
  306. this->button13->UseVisualStyleBackColor = true;
  307. this->button13->Click += gcnew System::EventHandler(this, &Form1::button13_Click);
  308. //
  309. // label2
  310. //
  311. this->label2->AutoSize = true;
  312. this->label2->Location = System::Drawing::Point(131, 161);
  313. this->label2->Name = L"label2";
  314. this->label2->Size = System::Drawing::Size(13, 13);
  315. this->label2->TabIndex = 17;
  316. this->label2->Text = L"0";
  317. //
  318. // label3
  319. //
  320. this->label3->AutoSize = true;
  321. this->label3->Location = System::Drawing::Point(150, 161);
  322. this->label3->Name = L"label3";
  323. this->label3->Size = System::Drawing::Size(10, 13);
  324. this->label3->TabIndex = 18;
  325. this->label3->Text = L":";
  326. //
  327. // label4
  328. //
  329. this->label4->AutoSize = true;
  330. this->label4->Location = System::Drawing::Point(166, 161);
  331. this->label4->Name = L"label4";
  332. this->label4->Size = System::Drawing::Size(13, 13);
  333. this->label4->TabIndex = 19;
  334. this->label4->Text = L"0";
  335. //
  336. // button14
  337. //
  338. this->button14->Location = System::Drawing::Point(205, 171);
  339. this->button14->Name = L"button14";
  340. this->button14->Size = System::Drawing::Size(75, 23);
  341. this->button14->TabIndex = 20;
  342. this->button14->Text = L"pravitko";
  343. this->button14->UseVisualStyleBackColor = true;
  344. this->button14->Click += gcnew System::EventHandler(this, &Form1::button14_Click);
  345. //
  346. // pictureBox2
  347. //
  348. this->pictureBox2->BackColor = System::Drawing::SystemColors::ButtonHighlight;
  349. this->pictureBox2->Location = System::Drawing::Point(285, 171);
  350. this->pictureBox2->Name = L"pictureBox2";
  351. this->pictureBox2->Size = System::Drawing::Size(700, 200);
  352. this->pictureBox2->TabIndex = 21;
  353. this->pictureBox2->TabStop = false;
  354. //
  355. // button15
  356. //
  357. this->button15->Location = System::Drawing::Point(853, 113);
  358. this->button15->Name = L"button15";
  359. this->button15->Size = System::Drawing::Size(131, 43);
  360. this->button15->TabIndex = 22;
  361. this->button15->Text = L"vypis text";
  362. this->button15->UseVisualStyleBackColor = true;
  363. this->button15->Click += gcnew System::EventHandler(this, &Form1::button15_Click);
  364. //
  365. // label5
  366. //
  367. this->label5->AutoSize = true;
  368. this->label5->Location = System::Drawing::Point(394, 113);
  369. this->label5->Name = L"label5";
  370. this->label5->Size = System::Drawing::Size(61, 13);
  371. this->label5->TabIndex = 23;
  372. this->label5->Text = L"zadajte text";
  373. //
  374. // textBox2
  375. //
  376. this->textBox2->Location = System::Drawing::Point(397, 136);
  377. this->textBox2->Name = L"textBox2";
  378. this->textBox2->Size = System::Drawing::Size(450, 20);
  379. this->textBox2->TabIndex = 24;
  380. //
  381. // checkBox1
  382. //
  383. this->checkBox1->AutoSize = true;
  384. this->checkBox1->Location = System::Drawing::Point(853, 27);
  385. this->checkBox1->Name = L"checkBox1";
  386. this->checkBox1->Size = System::Drawing::Size(48, 17);
  387. this->checkBox1->TabIndex = 25;
  388. this->checkBox1->Text = L"Italic";
  389. this->checkBox1->UseVisualStyleBackColor = true;
  390. //
  391. // checkBox2
  392. //
  393. this->checkBox2->AutoSize = true;
  394. this->checkBox2->Location = System::Drawing::Point(853, 50);
  395. this->checkBox2->Name = L"checkBox2";
  396. this->checkBox2->Size = System::Drawing::Size(47, 17);
  397. this->checkBox2->TabIndex = 26;
  398. this->checkBox2->Text = L"Bold";
  399. this->checkBox2->UseVisualStyleBackColor = true;
  400. //
  401. // checkBox3
  402. //
  403. this->checkBox3->AutoSize = true;
  404. this->checkBox3->Location = System::Drawing::Point(853, 71);
  405. this->checkBox3->Name = L"checkBox3";
  406. this->checkBox3->Size = System::Drawing::Size(71, 17);
  407. this->checkBox3->TabIndex = 27;
  408. this->checkBox3->Text = L"Underline";
  409. this->checkBox3->UseVisualStyleBackColor = true;
  410. //
  411. // comboBox2
  412. //
  413. this->comboBox2->FormattingEnabled = true;
  414. this->comboBox2->Items->AddRange(gcnew cli::array< System::Object^ >(4) {L"font1", L"font2", L"font3", L"font4"});
  415. this->comboBox2->Location = System::Drawing::Point(663, 44);
  416. this->comboBox2->Name = L"comboBox2";
  417. this->comboBox2->Size = System::Drawing::Size(107, 21);
  418. this->comboBox2->TabIndex = 28;
  419. //
  420. // label6
  421. //
  422. this->label6->AutoSize = true;
  423. this->label6->Location = System::Drawing::Point(660, 25);
  424. this->label6->Name = L"label6";
  425. this->label6->Size = System::Drawing::Size(187, 13);
  426. this->label6->TabIndex = 29;
  427. this->label6->Text = L"zvolte font ktorym chcete vykreslit text";
  428. //
  429. // label7
  430. //
  431. this->label7->AutoSize = true;
  432. this->label7->Location = System::Drawing::Point(660, 75);
  433. this->label7->Name = L"label7";
  434. this->label7->Size = System::Drawing::Size(71, 13);
  435. this->label7->TabIndex = 32;
  436. this->label7->Text = L"velkost pisma";
  437. //
  438. // numericUpDown1
  439. //
  440. this->numericUpDown1->Increment = System::Decimal(gcnew cli::array< System::Int32 >(4) {2, 0, 0, 0});
  441. this->numericUpDown1->Location = System::Drawing::Point(663, 106);
  442. this->numericUpDown1->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {70, 0, 0, 0});
  443. this->numericUpDown1->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {30, 0, 0, 0});
  444. this->numericUpDown1->Name = L"numericUpDown1";
  445. this->numericUpDown1->Size = System::Drawing::Size(120, 20);
  446. this->numericUpDown1->TabIndex = 33;
  447. this->numericUpDown1->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {30, 0, 0, 0});
  448. this->numericUpDown1->ValueChanged += gcnew System::EventHandler(this, &Form1::numericUpDown1_ValueChanged);
  449. //
  450. // button16
  451. //
  452. this->button16->Location = System::Drawing::Point(551, 25);
  453. this->button16->Name = L"button16";
  454. this->button16->Size = System::Drawing::Size(85, 29);
  455. this->button16->TabIndex = 34;
  456. this->button16->Text = L"farba";
  457. this->button16->UseVisualStyleBackColor = true;
  458. this->button16->Click += gcnew System::EventHandler(this, &Form1::button16_Click);
  459. //
  460. // Form1
  461. //
  462. this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
  463. this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
  464. this->ClientSize = System::Drawing::Size(1000, 374);
  465. this->Controls->Add(this->button16);
  466. this->Controls->Add(this->numericUpDown1);
  467. this->Controls->Add(this->label7);
  468. this->Controls->Add(this->label6);
  469. this->Controls->Add(this->comboBox2);
  470. this->Controls->Add(this->checkBox3);
  471. this->Controls->Add(this->checkBox2);
  472. this->Controls->Add(this->checkBox1);
  473. this->Controls->Add(this->textBox2);
  474. this->Controls->Add(this->label5);
  475. this->Controls->Add(this->button15);
  476. this->Controls->Add(this->pictureBox2);
  477. this->Controls->Add(this->button14);
  478. this->Controls->Add(this->label4);
  479. this->Controls->Add(this->label3);
  480. this->Controls->Add(this->label2);
  481. this->Controls->Add(this->button13);
  482. this->Controls->Add(this->button12);
  483. this->Controls->Add(this->button11);
  484. this->Controls->Add(this->button10);
  485. this->Controls->Add(this->button9);
  486. this->Controls->Add(this->button8);
  487. this->Controls->Add(this->button7);
  488. this->Controls->Add(this->button6);
  489. this->Controls->Add(this->button5);
  490. this->Controls->Add(this->button4);
  491. this->Controls->Add(this->button3);
  492. this->Controls->Add(this->button2);
  493. this->Controls->Add(this->button1);
  494. this->Controls->Add(this->label1);
  495. this->Controls->Add(this->textBox1);
  496. this->Controls->Add(this->comboBox1);
  497. this->Controls->Add(this->pictureBox1);
  498. this->Name = L"Form1";
  499. this->Text = L"Form1";
  500. (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->EndInit();
  501. (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox2))->EndInit();
  502. (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown1))->EndInit();
  503. this->ResumeLayout(false);
  504. this->PerformLayout();
  505. }
  506. void Vypni()
  507. {
  508. usecka=Lciara=polygon=kruznica=obluk=elipsa=eobluk=krivka=i=0;
  509. }
  510. #pragma endregion
  511. private: System::Void pictureBox1_Click(System::Object^ sender, System::EventArgs^ e) {
  512. PointF help;
  513. string pomoc;
  514. help = pictureBox1->PointToClient(pictureBox1->MousePosition);
  515. body[i].X=help.X;
  516. body[i].Y=help.Y;
  517. grafika->DrawRectangle(pero,help.X,help.Y,1.,1.);
  518. if(usecka)
  519. if(i==1)
  520. {
  521. grafika->DrawLine(pero, body[0].X,body[0].Y,body[1].X,body[1].Y);
  522. Vypni();
  523. fstream subor;
  524. subor.open(perif.nazov(),fstream::out | fstream::app);
  525. subor<<body[0].X<<endl<<body[0].Y<<endl<<body[1].X<<endl<<body[1].Y<<endl;
  526. subor.close();
  527. }
  528. if (Lciara)
  529. {
  530. if (i>=1)
  531. {
  532. grafika->DrawLine(pero,body[i].X,body[i].Y,body[i-1].X,body[i-1].Y);
  533. }
  534. }
  535. if (polygon)
  536. {
  537. if (i>=1)
  538. {
  539. for (int j = 0; j < i; j++)
  540. {
  541. grafika->DrawLine(pero,body[j],body[j+1]);
  542. }
  543. }
  544. }
  545. if (kruznica)
  546. {
  547. if (i==1)
  548. {
  549. polomer=sqrt( pow(body[1].X-body[0].X,2) + pow(body[1].Y - body[0].Y,2) );
  550. grafika->DrawEllipse(pero,body[0].X-polomer,body[0].Y-polomer,2*polomer,2*polomer);
  551. fstream subor;
  552. subor.open(perif.nazov(),fstream::out | fstream::app);
  553. subor<<body[0].X<<endl<<body[0].Y<<endl<<polomer<<endl;
  554. Vypni();
  555. }
  556. }
  557. if (obluk)
  558. {
  559. if (i==2)
  560. {
  561. polomer=sqrt( pow(body[1].X-body[0].X,2) + pow(body[1].Y - body[0].Y,2) );
  562. suhol=acos( (body[1].X-body[0].X)/polomer)*(180/3.14);
  563. if(body[0].Y>body[1].Y)
  564. suhol=360-suhol;
  565. 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);
  566. grafika->DrawArc(pero,body[0].X-polomer,body[0].Y-polomer,2*polomer,2*polomer,suhol,duhol);
  567. fstream subor;
  568. subor.open(perif.nazov(),fstream::out | fstream::app);
  569. subor<<body[0].X<<endl<<body[0].Y<<endl<<polomer<<endl<<suhol<<endl<<duhol<<endl;
  570. Vypni();
  571. }
  572. }
  573. if (elipsa)
  574. {
  575. if (i==2)
  576. {
  577. polomer=sqrt( pow(body[1].X-body[0].X,2) + pow(body[1].Y - body[0].Y,2) );
  578. polomer2=sqrt( pow(body[2].X-body[0].X,2) + pow(body[2].Y - body[0].Y,2) );
  579. grafika->DrawEllipse(pero,body[0].X-polomer,body[0].Y-polomer2,2*polomer,2*polomer2);
  580. fstream subor;
  581. subor.open(perif.nazov(),fstream::out | fstream::app);
  582. subor<<body[0].X<<endl<<body[0].Y<<endl<<polomer<<endl<<polomer2<<endl;
  583. Vypni();
  584. }
  585. }
  586. if (eobluk)
  587. {
  588. if (i==4)
  589. {
  590. polomer=sqrt( pow(body[3].X-body[0].X,2) + pow(body[3].Y - body[0].Y,2) );
  591. polomer2=sqrt( pow(body[4].X-body[0].X,2) + pow(body[4].Y - body[0].Y,2) );
  592. suhol=acos( (body[3].X-body[0].X)/polomer)*(180/3.14);
  593. if(body[0].Y>body[3].Y)
  594. suhol=360-suhol;
  595. 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);
  596. grafika->DrawArc(pero,body[0].X-polomer,body[0].Y-polomer2,2*polomer,2*polomer2,suhol,duhol);
  597. fstream subor;
  598. subor.open(perif.nazov(),fstream::out | fstream::app);
  599. subor<<body[0].X<<endl<<body[0].Y<<endl<<polomer<<endl<<polomer2<<endl<<suhol<<endl<<duhol<<endl;
  600. Vypni();
  601. }
  602. }
  603. if (krivka)
  604. {
  605. if (i==0)
  606. {
  607. body[1]=body[0];
  608. i++;
  609. body[2]=body[0];
  610. i++;
  611. body[3]=body[0];
  612. i++;
  613. }
  614. }
  615. i++;
  616. }
  617. private: System::Void comboBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
  618. font=comboBox1->SelectedIndex;
  619. }
  620. private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
  621. string pomoc;
  622. stringstream help;
  623. help<<font+1;
  624. help>>pomoc;
  625. pomoc+=perif.StringNastring(textBox1->Text);
  626. pomoc+=".txt";
  627. perif.uloz_nazov(pomoc);
  628. }
  629. private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
  630. Vypni();
  631. usecka=1;
  632. fstream subor(perif.nazov(),fstream::out | fstream::app);
  633. subor<<"Line"<<endl;
  634. subor.close();
  635. }
  636. private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
  637. Vypni();
  638. Lciara=1;
  639. fstream subor(perif.nazov(),fstream::out | fstream::app);
  640. subor<<"LLine"<<endl;
  641. subor.close();
  642. }
  643. private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) {
  644. Vypni();
  645. polygon=1;
  646. fstream subor(perif.nazov(),fstream::out | fstream::app);
  647. subor<<"Polyg"<<endl;
  648. subor.close();
  649. }
  650. private: System::Void button6_Click(System::Object^ sender, System::EventArgs^ e) {
  651. Vypni();
  652. kruznica=1;
  653. fstream subor(perif.nazov(),fstream::out | fstream::app);
  654. subor<<"Circle"<<endl;
  655. subor.close();
  656. }
  657. private: System::Void button7_Click(System::Object^ sender, System::EventArgs^ e) {
  658. Vypni();
  659. obluk=1;
  660. fstream subor(perif.nazov(),fstream::out | fstream::app);
  661. subor<<"CArc"<<endl;
  662. subor.close();
  663. }
  664. private: System::Void button8_Click(System::Object^ sender, System::EventArgs^ e) {
  665. Vypni();
  666. elipsa=1;
  667. fstream subor(perif.nazov(),fstream::out | fstream::app);
  668. subor<<"Ellipse"<<endl;
  669. subor.close();
  670. }
  671. private: System::Void button9_Click(System::Object^ sender, System::EventArgs^ e) {
  672. Vypni();
  673. eobluk=1;
  674. fstream subor(perif.nazov(),fstream::out | fstream::app);
  675. subor<<"EllArc"<<endl;
  676. subor.close();
  677. }
  678. private: System::Void button10_Click(System::Object^ sender, System::EventArgs^ e) {
  679. Vypni();
  680. krivka=1;
  681. fstream subor(perif.nazov(),fstream::out | fstream::app);
  682. subor<<"Curve"<<endl;
  683. subor.close();
  684. }
  685. private: System::Void button11_Click(System::Object^ sender, System::EventArgs^ e) {
  686. if(Lciara)
  687. {
  688. fstream subor;
  689. subor.open(perif.nazov(),fstream::out | fstream::app);
  690. subor<<i<<endl;
  691. for (int j = 0; j < i; j++)
  692. {
  693. subor<<body[j].X/10.0<<endl<<body[j].Y/10.0<<endl;
  694. }
  695. Vypni();
  696. }
  697. }
  698. private: System::Void button12_Click(System::Object^ sender, System::EventArgs^ e) {
  699. if (polygon)
  700. {
  701. grafika->DrawLine(pero,body[0],body[i-1]);
  702. fstream subor;
  703. subor.open(perif.nazov(),fstream::out | fstream::app);
  704. subor<<i<<endl;
  705. for (int j = 0; j < i; j++)
  706. {
  707. subor<<body[j].X/10.0<<endl<<body[j].Y/10.0<<endl;
  708. }
  709. Vypni();
  710. }
  711. }
  712. private: System::Void button13_Click(System::Object^ sender, System::EventArgs^ e) {
  713. if (krivka)
  714. {
  715. body[i]=body[i-1];
  716. i++;
  717. body[i]=body[i-2];
  718. i++;
  719. float px,py;
  720. px=py=0;
  721. for (int k = 0; k < i-3; k++)
  722. {
  723. for (float t = 0; t <= 1; t+=0.05)
  724. {
  725. 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;
  726. 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;
  727. grafika->DrawRectangle(pero,px,py,1.,1.);
  728. }
  729. }
  730. fstream subor;
  731. subor.open(perif.nazov(),fstream::out | fstream::app);
  732. subor<<i<<endl;
  733. for (int j = 0; j < i; j++)
  734. {
  735. subor<<body[j].X<<endl<<body[j].Y<<endl;
  736. }
  737. Vypni();
  738. }
  739. }
  740. private: System::Void pictureBox1_MouseHover(System::Object^ sender, System::EventArgs^ e) {
  741. inpic=1;
  742. }
  743. private: System::Void pictureBox1_MouseMove(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
  744. Point help;
  745. help = pictureBox1->PointToClient(pictureBox1->MousePosition);
  746. if(inpic)
  747. {
  748. label2->Text=Convert::ToString(help.X);
  749. label4->Text=Convert::ToString(help.Y);
  750. }
  751. }
  752. private: System::Void pictureBox1_MouseLeave(System::Object^ sender, System::EventArgs^ e) {
  753. inpic=0;
  754. }
  755. private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
  756. grafika->Clear(Color::White);
  757. }
  758. private: System::Void button14_Click(System::Object^ sender, System::EventArgs^ e) {
  759. if(pravitko->Color==Color::Black)
  760. {
  761. pravitko->Color=Color::White;
  762. grafika->DrawLine(pravitko,1,1,1,99);
  763. grafika->DrawLine(pravitko,1,1,99,1);
  764. for (int p = 0; p <= 100; p+=10)
  765. {
  766. grafika->DrawLine(pravitko,0,p,2,p);
  767. grafika->DrawLine(pravitko,p,0,p,2);
  768. }
  769. pravitko->Color=Color::Black;
  770. }
  771. if(pravitko->Color==Color::White)
  772. {
  773. pravitko->Color=Color::Black;
  774. grafika->DrawLine(pravitko,1,1,1,99);
  775. grafika->DrawLine(pravitko,1,1,99,1);
  776. for (int p = 0; p <= 100; p+=10)
  777. {
  778. grafika->DrawLine(pravitko,0,p,2,p);
  779. grafika->DrawLine(pravitko,p,0,p,2);
  780. }
  781. pravitko->Color=Color::White;
  782. }
  783. if (pravitko->Color==Color::White)
  784. {
  785. pravitko->Color=Color::Black;
  786. }
  787. else
  788. {
  789. pravitko->Color=Color::White;
  790. }
  791. }
  792. public: static float velkost=0.3;
  793. private: System::Void button15_Click(System::Object^ sender, System::EventArgs^ e)
  794. {
  795. Graphics^grafika2=pictureBox2->CreateGraphics();
  796. grafika2->Clear(Color::White);
  797. fstream subor;
  798. string text,typ,juhu=" ";
  799. String ^pom;
  800. float temp,r,r2,s,d;
  801. int l,i,j=0,posunx=0,posuny=0;
  802. char font_meno[6];
  803. const char *chtext;
  804. pom=textBox2->Text;
  805. text=perif.StringNastring(pom);
  806. chtext=(const char*)text.c_str();
  807. if(checkBox2->Checked)
  808. pero->Width=5;
  809. else
  810. pero->Width=1;
  811. //chtext->Length();
  812. while(true)
  813. {
  814. if(chtext[j]!=0)
  815. {
  816. {
  817. if(chtext[j]==' ')
  818. {
  819. posunx+=100*(2*velkost);
  820. j++;
  821. if(posunx>=700)
  822. {
  823. posunx=0;
  824. posuny+=100*(2*velkost);
  825. }
  826. }
  827. else
  828. {
  829. sprintf(font_meno,"%d%c.txt",(int(comboBox2->SelectedIndex)+1),chtext[j]);
  830. subor.open(font_meno,fstream::in);
  831. j++;
  832. if(subor.is_open())
  833. {
  834. subor.close();
  835. subor.open(font_meno,fstream::in);
  836. while(!subor.eof())
  837. {
  838. if(juhu==" ")
  839. subor>>typ;
  840. else
  841. typ=juhu;
  842. if(typ=="Line")
  843. {
  844. subor>>temp;
  845. body[0].X=(temp+posunx)*velkost;
  846. subor>>temp;
  847. body[0].Y=(temp+posuny)*velkost;
  848. subor>>temp;
  849. body[1].X=(temp+posunx)*velkost;
  850. subor>>temp;
  851. body[1].Y=(temp+posuny)*velkost;
  852. grafika2->DrawLine(pero,body[0],body[1]);
  853. }
  854. else
  855. if(typ=="Polyg")
  856. {
  857. subor>>l;
  858. array<PointF>^ polpoint=gcnew array <PointF>(l);
  859. for(i=0;i<l;i++)
  860. {
  861. subor>>temp;
  862. polpoint[i].X=(temp*10+posunx)*velkost;
  863. subor>>temp;
  864. polpoint[i].Y=(temp*10+posuny)*velkost;
  865. }
  866. for(i=0;i<l-1;i++)
  867. {
  868. grafika2->DrawLine(pero,polpoint[i],polpoint[i+1]);
  869. }
  870. grafika2->DrawLine(pero,polpoint[0],polpoint[l-1]);
  871. }
  872. else
  873. if(typ=="LLine")
  874. {
  875. subor>>l;
  876. array<PointF>^ polpoint=gcnew array <PointF>(l);
  877. for(i=0;i<l;i++)
  878. {
  879. subor>>temp;
  880. polpoint[i].X=(temp*10+posunx)*velkost;
  881. subor>>temp;
  882. polpoint[i].Y=(temp*10+posuny)*velkost;
  883. }
  884. for(i=0;i<l-1;i++)
  885. {
  886. grafika2->DrawLine(pero,polpoint[i],polpoint[i+1]);
  887. }
  888. }
  889. else
  890. if(typ=="Circle")
  891. {
  892. subor>>temp;
  893. body[0].X=(temp+posunx)*velkost;
  894. subor>>temp;
  895. body[0].Y=(temp+posuny)*velkost;
  896. subor>>r;
  897. r=r*velkost;
  898. grafika2->DrawEllipse(pero,body[0].X-r,body[0].Y-r,r*2,r*2);
  899. subor>>juhu;
  900. if(juhu==" ")
  901. break;
  902. }
  903. else
  904. if(typ=="CArc")
  905. {
  906. subor>>temp;
  907. body[0].X=(temp+posunx)*velkost;
  908. subor>>temp;
  909. body[0].Y=(temp+posuny)*velkost;
  910. subor>>r;
  911. subor>>s;
  912. subor>>d;
  913. r=r*velkost;
  914. s=s*velkost;
  915. d=d*velkost;
  916. grafika2->DrawArc(pero,body[0].X-r,body[0].Y-r,2*r,2*r,s,d);
  917. subor>>juhu;
  918. if(juhu==" ")
  919. break;
  920. }
  921. else
  922. if(typ=="Ellipse")
  923. {
  924. subor>>temp;
  925. body[0].X=(temp+posunx)*velkost;
  926. subor>>temp;
  927. body[0].Y=(temp+posuny)*velkost;
  928. subor>>r;
  929. subor>>r2;
  930. r=r*velkost;
  931. r2=r2*velkost;
  932. grafika2->DrawEllipse(pero,body[0].X-r,body[0].Y-r2,2*r,2*r2);
  933. subor>>juhu;
  934. if(juhu==" ")
  935. break;
  936. }
  937. else
  938. if(typ=="EllArc")
  939. {
  940. subor>>temp;
  941. body[0].X=(temp+posunx)*velkost;
  942. subor>>temp;
  943. body[0].Y=(temp+posuny)*velkost;
  944. subor>>r;
  945. subor>>r2;
  946. subor>>s;
  947. subor>>d;
  948. r=r*velkost;
  949. r2=r2*velkost;
  950. s=s*velkost;
  951. d=d*velkost;
  952. grafika2->DrawArc(pero,body[0].X-r,body[0].Y-r2,2*r,2*r2,s,d);
  953. subor>>juhu;
  954. if(juhu==" ")
  955. break;
  956. }
  957. else
  958. if(typ=="Curve")
  959. {
  960. subor>>l;
  961. array<PointF>^ cpoint=gcnew array <PointF>(l);
  962. for(i=0;i<l;i++)
  963. {
  964. subor>>temp;
  965. cpoint[i].X=(temp+posunx)*velkost;
  966. subor>>temp;
  967. cpoint[i].Y=(temp+posuny)*velkost;
  968. }
  969. grafika2->DrawCurve(pero,cpoint);
  970. }
  971. }
  972. }
  973. posunx+=100*(2*velkost);
  974. }
  975. }}
  976. else
  977. break;
  978. }
  979. if(checkBox3->Checked)
  980. grafika2->DrawLine(pero,0,int(100*velkost+posuny),int((posunx+100)*velkost),int(100*velkost+posuny));
  981. }
  982. private: System::Void numericUpDown1_ValueChanged(System::Object^ sender, System::EventArgs^ e)
  983. {
  984. velkost=(float)numericUpDown1->Value/100;
  985. }
  986. private: System::Void button16_Click(System::Object^ sender, System::EventArgs^ e)
  987. {
  988. ColorDialog^MyDialog= gcnew ColorDialog();
  989. MyDialog->AllowFullOpen=true;
  990. MyDialog->ShowHelp=true;
  991. if(MyDialog->ShowDialog()==::System::Windows::Forms::DialogResult::OK)
  992. pero->Color=MyDialog->Color;
  993. }
  994. };
  995. }