Advertisement
meta1211

Untitled

Feb 23rd, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.32 KB | None | 0 0
  1. #pragma once
  2. #include <cstring>
  3. #include "Opperations.h"
  4. #include <cmath>
  5. namespace Calc {
  6.  
  7. using namespace System;
  8. using namespace System::ComponentModel;
  9. using namespace System::Collections;
  10. using namespace System::Windows::Forms;
  11. using namespace System::Data;
  12. using namespace System::Drawing;
  13.  
  14. /// <summary>
  15. /// Сводка для MyForm
  16. /// </summary>
  17. public ref class MyForm : public System::Windows::Forms::Form
  18. {
  19. public:
  20. MyForm(void)
  21. {
  22. InitializeComponent();
  23. //
  24. //TODO: добавьте код конструктора
  25. //
  26. }
  27.  
  28. protected:
  29. /// <summary>
  30. /// Освободить все используемые ресурсы.
  31. /// </summary>
  32. ~MyForm()
  33. {
  34. if (components)
  35. {
  36. delete components;
  37. }
  38. }
  39. private: System::Windows::Forms::TextBox^ inputValue;
  40. private: System::Windows::Forms::TextBox^ bufferNum;
  41.  
  42.  
  43. private: System::Windows::Forms::Button^ Summ;
  44. private: System::Windows::Forms::TextBox^ opperatorBox;
  45. private: System::Windows::Forms::Button^ equal;
  46. private: System::Windows::Forms::Button^ plus0;
  47. private: System::Windows::Forms::Button^ plus1;
  48. private: System::Windows::Forms::Button^ plus2;
  49. private: System::Windows::Forms::Button^ plus3;
  50. private: System::Windows::Forms::Button^ plus4;
  51. private: System::Windows::Forms::Button^ plus5;
  52. private: System::Windows::Forms::Button^ plus6;
  53. private: System::Windows::Forms::Button^ plus7;
  54. private: System::Windows::Forms::Button^ plus8;
  55. private: System::Windows::Forms::Button^ plus9;
  56. private: System::Windows::Forms::Button^ addDot;
  57. private: System::Windows::Forms::Button^ diff;
  58. private: System::Windows::Forms::Button^ multip;
  59. private: System::Windows::Forms::Button^ disvion;
  60. private: System::Windows::Forms::Button^ reset;
  61. private: System::Windows::Forms::Button^ sign;
  62. private: System::Windows::Forms::Button^ resetCurrent;
  63.  
  64.  
  65.  
  66. private:
  67. /// <summary>
  68. /// Обязательная переменная конструктора.
  69. /// </summary>
  70. System::ComponentModel::Container ^components;
  71.  
  72. #pragma region Windows Form Designer generated code
  73. /// <summary>
  74. /// Требуемый метод для поддержки конструктора — не изменяйте
  75. /// содержимое этого метода с помощью редактора кода.
  76. /// </summary>
  77. void InitializeComponent(void)
  78. {
  79. System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(MyForm::typeid));
  80. this->inputValue = (gcnew System::Windows::Forms::TextBox());
  81. this->bufferNum = (gcnew System::Windows::Forms::TextBox());
  82. this->Summ = (gcnew System::Windows::Forms::Button());
  83. this->opperatorBox = (gcnew System::Windows::Forms::TextBox());
  84. this->equal = (gcnew System::Windows::Forms::Button());
  85. this->plus0 = (gcnew System::Windows::Forms::Button());
  86. this->plus1 = (gcnew System::Windows::Forms::Button());
  87. this->plus2 = (gcnew System::Windows::Forms::Button());
  88. this->plus3 = (gcnew System::Windows::Forms::Button());
  89. this->plus4 = (gcnew System::Windows::Forms::Button());
  90. this->plus5 = (gcnew System::Windows::Forms::Button());
  91. this->plus6 = (gcnew System::Windows::Forms::Button());
  92. this->plus7 = (gcnew System::Windows::Forms::Button());
  93. this->plus8 = (gcnew System::Windows::Forms::Button());
  94. this->plus9 = (gcnew System::Windows::Forms::Button());
  95. this->addDot = (gcnew System::Windows::Forms::Button());
  96. this->diff = (gcnew System::Windows::Forms::Button());
  97. this->multip = (gcnew System::Windows::Forms::Button());
  98. this->disvion = (gcnew System::Windows::Forms::Button());
  99. this->reset = (gcnew System::Windows::Forms::Button());
  100. this->sign = (gcnew System::Windows::Forms::Button());
  101. this->resetCurrent = (gcnew System::Windows::Forms::Button());
  102. this->SuspendLayout();
  103. //
  104. // inputValue
  105. //
  106. this->inputValue->BackColor = System::Drawing::Color::LightCyan;
  107. this->inputValue->BorderStyle = System::Windows::Forms::BorderStyle::None;
  108. this->inputValue->Cursor = System::Windows::Forms::Cursors::Default;
  109. this->inputValue->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  110. static_cast<System::Byte>(204)));
  111. this->inputValue->Location = System::Drawing::Point(12, 41);
  112. this->inputValue->Name = L"inputValue";
  113. this->inputValue->ReadOnly = true;
  114. this->inputValue->Size = System::Drawing::Size(250, 31);
  115. this->inputValue->TabIndex = 5;
  116. //
  117. // bufferNum
  118. //
  119. this->bufferNum->BackColor = System::Drawing::Color::LightCyan;
  120. this->bufferNum->BorderStyle = System::Windows::Forms::BorderStyle::None;
  121. this->bufferNum->Cursor = System::Windows::Forms::Cursors::Default;
  122. this->bufferNum->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 10, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  123. static_cast<System::Byte>(204)));
  124. this->bufferNum->Location = System::Drawing::Point(12, 25);
  125. this->bufferNum->Name = L"bufferNum";
  126. this->bufferNum->ReadOnly = true;
  127. this->bufferNum->Size = System::Drawing::Size(250, 16);
  128. this->bufferNum->TabIndex = 10;
  129. //
  130. // Summ
  131. //
  132. this->Summ->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  133. this->Summ->FlatAppearance->BorderSize = 0;
  134. this->Summ->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  135. static_cast<System::Byte>(204)));
  136. this->Summ->Location = System::Drawing::Point(61, 78);
  137. this->Summ->Name = L"Summ";
  138. this->Summ->Size = System::Drawing::Size(50, 50);
  139. this->Summ->TabIndex = 11;
  140. this->Summ->Text = L"+";
  141. this->Summ->UseVisualStyleBackColor = true;
  142. this->Summ->Click += gcnew System::EventHandler(this, &MyForm::Summ_Click);
  143. //
  144. // opperatorBox
  145. //
  146. this->opperatorBox->BackColor = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(226)), static_cast<System::Int32>(static_cast<System::Byte>(235)),
  147. static_cast<System::Int32>(static_cast<System::Byte>(246)));
  148. this->opperatorBox->BorderStyle = System::Windows::Forms::BorderStyle::None;
  149. this->opperatorBox->Cursor = System::Windows::Forms::Cursors::Default;
  150. this->opperatorBox->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 10, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  151. static_cast<System::Byte>(204)));
  152. this->opperatorBox->Location = System::Drawing::Point(268, 23);
  153. this->opperatorBox->Name = L"opperatorBox";
  154. this->opperatorBox->ReadOnly = true;
  155. this->opperatorBox->Size = System::Drawing::Size(16, 16);
  156. this->opperatorBox->TabIndex = 12;
  157. //
  158. // equal
  159. //
  160. this->equal->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  161. this->equal->FlatAppearance->BorderSize = 0;
  162. this->equal->Location = System::Drawing::Point(229, 246);
  163. this->equal->Name = L"equal";
  164. this->equal->Size = System::Drawing::Size(52, 50);
  165. this->equal->TabIndex = 13;
  166. this->equal->Text = L"=";
  167. this->equal->UseVisualStyleBackColor = true;
  168. this->equal->Click += gcnew System::EventHandler(this, &MyForm::equal_Click);
  169. //
  170. // plus0
  171. //
  172. this->plus0->AccessibleName = L"";
  173. this->plus0->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  174. this->plus0->FlatAppearance->BorderSize = 0;
  175. this->plus0->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  176. static_cast<System::Byte>(204)));
  177. this->plus0->Location = System::Drawing::Point(117, 246);
  178. this->plus0->Name = L"plus0";
  179. this->plus0->Size = System::Drawing::Size(50, 50);
  180. this->plus0->TabIndex = 9;
  181. this->plus0->Text = L"0";
  182. this->plus0->UseVisualStyleBackColor = true;
  183. this->plus0->Click += gcnew System::EventHandler(this, &MyForm::plus0_Click);
  184. //
  185. // plus1
  186. //
  187. this->plus1->AccessibleName = L"";
  188. this->plus1->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  189. this->plus1->FlatAppearance->BorderSize = 0;
  190. this->plus1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  191. static_cast<System::Byte>(204)));
  192. this->plus1->Location = System::Drawing::Point(117, 78);
  193. this->plus1->Name = L"plus1";
  194. this->plus1->Size = System::Drawing::Size(50, 50);
  195. this->plus1->TabIndex = 7;
  196. this->plus1->Text = L"1";
  197. this->plus1->UseVisualStyleBackColor = true;
  198. this->plus1->Click += gcnew System::EventHandler(this, &MyForm::plus1_Click);
  199. //
  200. // plus2
  201. //
  202. this->plus2->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  203. this->plus2->FlatAppearance->BorderSize = 0;
  204. this->plus2->Font = (gcnew System::Drawing::Font(L"Microsoft Tai Le", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  205. static_cast<System::Byte>(204)));
  206. this->plus2->Location = System::Drawing::Point(173, 78);
  207. this->plus2->Name = L"plus2";
  208. this->plus2->Size = System::Drawing::Size(50, 50);
  209. this->plus2->TabIndex = 8;
  210. this->plus2->Text = L"2";
  211. this->plus2->UseVisualStyleBackColor = true;
  212. this->plus2->Click += gcnew System::EventHandler(this, &MyForm::plus2_Click);
  213. //
  214. // plus3
  215. //
  216. this->plus3->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  217. this->plus3->FlatAppearance->BorderSize = 0;
  218. this->plus3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  219. static_cast<System::Byte>(204)));
  220. this->plus3->Location = System::Drawing::Point(229, 78);
  221. this->plus3->Name = L"plus3";
  222. this->plus3->Size = System::Drawing::Size(50, 50);
  223. this->plus3->TabIndex = 8;
  224. this->plus3->Text = L"3";
  225. this->plus3->UseVisualStyleBackColor = true;
  226. this->plus3->Click += gcnew System::EventHandler(this, &MyForm::plus3_Click);
  227. //
  228. // plus4
  229. //
  230. this->plus4->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  231. this->plus4->FlatAppearance->BorderSize = 0;
  232. this->plus4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  233. static_cast<System::Byte>(204)));
  234. this->plus4->Location = System::Drawing::Point(115, 134);
  235. this->plus4->Name = L"plus4";
  236. this->plus4->Size = System::Drawing::Size(50, 50);
  237. this->plus4->TabIndex = 8;
  238. this->plus4->Text = L"4";
  239. this->plus4->UseVisualStyleBackColor = true;
  240. this->plus4->Click += gcnew System::EventHandler(this, &MyForm::plus4_Click);
  241. //
  242. // plus5
  243. //
  244. this->plus5->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  245. this->plus5->FlatAppearance->BorderSize = 0;
  246. this->plus5->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  247. static_cast<System::Byte>(204)));
  248. this->plus5->Location = System::Drawing::Point(173, 134);
  249. this->plus5->Name = L"plus5";
  250. this->plus5->Size = System::Drawing::Size(50, 50);
  251. this->plus5->TabIndex = 8;
  252. this->plus5->Text = L"5";
  253. this->plus5->UseVisualStyleBackColor = true;
  254. this->plus5->Click += gcnew System::EventHandler(this, &MyForm::plus5_Click);
  255. //
  256. // plus6
  257. //
  258. this->plus6->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  259. this->plus6->FlatAppearance->BorderSize = 0;
  260. this->plus6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  261. static_cast<System::Byte>(204)));
  262. this->plus6->Location = System::Drawing::Point(229, 134);
  263. this->plus6->Name = L"plus6";
  264. this->plus6->Size = System::Drawing::Size(50, 50);
  265. this->plus6->TabIndex = 8;
  266. this->plus6->Text = L"6";
  267. this->plus6->UseVisualStyleBackColor = true;
  268. this->plus6->Click += gcnew System::EventHandler(this, &MyForm::plus6_Click);
  269. //
  270. // plus7
  271. //
  272. this->plus7->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  273. this->plus7->FlatAppearance->BorderSize = 0;
  274. this->plus7->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  275. static_cast<System::Byte>(204)));
  276. this->plus7->Location = System::Drawing::Point(117, 190);
  277. this->plus7->Name = L"plus7";
  278. this->plus7->Size = System::Drawing::Size(50, 50);
  279. this->plus7->TabIndex = 8;
  280. this->plus7->Text = L"7";
  281. this->plus7->UseVisualStyleBackColor = true;
  282. this->plus7->Click += gcnew System::EventHandler(this, &MyForm::plus7_Click);
  283. //
  284. // plus8
  285. //
  286. this->plus8->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  287. this->plus8->FlatAppearance->BorderSize = 0;
  288. this->plus8->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  289. static_cast<System::Byte>(204)));
  290. this->plus8->Location = System::Drawing::Point(173, 190);
  291. this->plus8->Name = L"plus8";
  292. this->plus8->Size = System::Drawing::Size(50, 50);
  293. this->plus8->TabIndex = 8;
  294. this->plus8->Text = L"8";
  295. this->plus8->UseVisualStyleBackColor = true;
  296. this->plus8->Click += gcnew System::EventHandler(this, &MyForm::plus8_Click);
  297. //
  298. // plus9
  299. //
  300. this->plus9->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  301. this->plus9->FlatAppearance->BorderSize = 0;
  302. this->plus9->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  303. static_cast<System::Byte>(204)));
  304. this->plus9->Location = System::Drawing::Point(229, 190);
  305. this->plus9->Name = L"plus9";
  306. this->plus9->Size = System::Drawing::Size(50, 50);
  307. this->plus9->TabIndex = 8;
  308. this->plus9->Text = L"9";
  309. this->plus9->UseVisualStyleBackColor = true;
  310. this->plus9->Click += gcnew System::EventHandler(this, &MyForm::plus9_Click);
  311. //
  312. // addDot
  313. //
  314. this->addDot->AccessibleName = L"";
  315. this->addDot->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  316. this->addDot->FlatAppearance->BorderSize = 0;
  317. this->addDot->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  318. static_cast<System::Byte>(204)));
  319. this->addDot->Location = System::Drawing::Point(173, 246);
  320. this->addDot->Name = L"addDot";
  321. this->addDot->Size = System::Drawing::Size(50, 50);
  322. this->addDot->TabIndex = 14;
  323. this->addDot->Text = L".";
  324. this->addDot->UseVisualStyleBackColor = true;
  325. this->addDot->Click += gcnew System::EventHandler(this, &MyForm::addDot_Click);
  326. //
  327. // diff
  328. //
  329. this->diff->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  330. this->diff->FlatAppearance->BorderSize = 0;
  331. this->diff->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  332. static_cast<System::Byte>(204)));
  333. this->diff->Location = System::Drawing::Point(61, 134);
  334. this->diff->Name = L"diff";
  335. this->diff->Size = System::Drawing::Size(50, 49);
  336. this->diff->TabIndex = 15;
  337. this->diff->Text = L"-";
  338. this->diff->UseVisualStyleBackColor = true;
  339. this->diff->Click += gcnew System::EventHandler(this, &MyForm::diff_Click);
  340. //
  341. // multip
  342. //
  343. this->multip->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  344. this->multip->FlatAppearance->BorderSize = 0;
  345. this->multip->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  346. static_cast<System::Byte>(204)));
  347. this->multip->Location = System::Drawing::Point(61, 190);
  348. this->multip->Name = L"multip";
  349. this->multip->Size = System::Drawing::Size(50, 49);
  350. this->multip->TabIndex = 16;
  351. this->multip->Text = L"*";
  352. this->multip->UseVisualStyleBackColor = true;
  353. this->multip->Click += gcnew System::EventHandler(this, &MyForm::multip_Click);
  354. //
  355. // disvion
  356. //
  357. this->disvion->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  358. this->disvion->FlatAppearance->BorderSize = 0;
  359. this->disvion->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  360. static_cast<System::Byte>(204)));
  361. this->disvion->Location = System::Drawing::Point(61, 246);
  362. this->disvion->Name = L"disvion";
  363. this->disvion->Size = System::Drawing::Size(49, 49);
  364. this->disvion->TabIndex = 17;
  365. this->disvion->Text = L"/";
  366. this->disvion->UseVisualStyleBackColor = true;
  367. this->disvion->Click += gcnew System::EventHandler(this, &MyForm::disvion_Click);
  368. //
  369. // reset
  370. //
  371. this->reset->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  372. this->reset->FlatAppearance->BorderSize = 0;
  373. this->reset->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  374. static_cast<System::Byte>(204)));
  375. this->reset->Location = System::Drawing::Point(6, 78);
  376. this->reset->Name = L"reset";
  377. this->reset->Size = System::Drawing::Size(49, 50);
  378. this->reset->TabIndex = 18;
  379. this->reset->Text = L"C";
  380. this->reset->UseVisualStyleBackColor = true;
  381. this->reset->Click += gcnew System::EventHandler(this, &MyForm::reset_Click);
  382. //
  383. // sign
  384. //
  385. this->sign->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  386. this->sign->FlatAppearance->BorderSize = 0;
  387. this->sign->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  388. static_cast<System::Byte>(204)));
  389. this->sign->Location = System::Drawing::Point(6, 189);
  390. this->sign->Name = L"sign";
  391. this->sign->Size = System::Drawing::Size(49, 50);
  392. this->sign->TabIndex = 19;
  393. this->sign->Text = L"±";
  394. this->sign->UseVisualStyleBackColor = true;
  395. this->sign->Click += gcnew System::EventHandler(this, &MyForm::sign_Click);
  396. //
  397. // resetCurrent
  398. //
  399. this->resetCurrent->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  400. this->resetCurrent->FlatAppearance->BorderSize = 0;
  401. this->resetCurrent->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  402. static_cast<System::Byte>(204)));
  403. this->resetCurrent->Location = System::Drawing::Point(6, 134);
  404. this->resetCurrent->Name = L"resetCurrent";
  405. this->resetCurrent->Size = System::Drawing::Size(49, 49);
  406. this->resetCurrent->TabIndex = 20;
  407. this->resetCurrent->Text = L"CE";
  408. this->resetCurrent->UseVisualStyleBackColor = true;
  409. this->resetCurrent->Click += gcnew System::EventHandler(this, &MyForm::resetCurrent_Click);
  410. //
  411. // MyForm
  412. //
  413. this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
  414. this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
  415. this->BackColor = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(226)), static_cast<System::Int32>(static_cast<System::Byte>(235)),
  416. static_cast<System::Int32>(static_cast<System::Byte>(246)));
  417. this->ClientSize = System::Drawing::Size(289, 315);
  418. this->Controls->Add(this->resetCurrent);
  419. this->Controls->Add(this->sign);
  420. this->Controls->Add(this->reset);
  421. this->Controls->Add(this->disvion);
  422. this->Controls->Add(this->multip);
  423. this->Controls->Add(this->diff);
  424. this->Controls->Add(this->addDot);
  425. this->Controls->Add(this->plus9);
  426. this->Controls->Add(this->plus8);
  427. this->Controls->Add(this->plus7);
  428. this->Controls->Add(this->plus0);
  429. this->Controls->Add(this->plus6);
  430. this->Controls->Add(this->equal);
  431. this->Controls->Add(this->plus5);
  432. this->Controls->Add(this->opperatorBox);
  433. this->Controls->Add(this->plus4);
  434. this->Controls->Add(this->Summ);
  435. this->Controls->Add(this->plus3);
  436. this->Controls->Add(this->bufferNum);
  437. this->Controls->Add(this->plus2);
  438. this->Controls->Add(this->plus1);
  439. this->Controls->Add(this->inputValue);
  440. this->HelpButton = true;
  441. this->Icon = (cli::safe_cast<System::Drawing::Icon^>(resources->GetObject(L"$this.Icon")));
  442. this->ImeMode = System::Windows::Forms::ImeMode::NoControl;
  443. this->KeyPreview = true;
  444. this->Name = L"MyForm";
  445. this->Text = L"Calculator";
  446. this->Load += gcnew System::EventHandler(this, &MyForm::MyForm_Load);
  447. this->ResumeLayout(false);
  448. this->PerformLayout();
  449.  
  450. }
  451. #pragma endregion
  452. private: System::Void MyForm_Load(System::Object^ sender, System::EventArgs^ e)
  453. {
  454.  
  455. }
  456.  
  457. //Кнопки ввода числа
  458. private: System::Void plus0_Click(System::Object^ sender, System::EventArgs^ e) {
  459. if(inputValue->TextLength > 1)
  460. inputValue->Text = inputNum(0, inputValue->Text);
  461. }
  462. private: System::Void plus1_Click(System::Object^ sender, System::EventArgs^ e) {
  463. inputValue->Text = inputNum(1, inputValue->Text);
  464. }
  465. private: System::Void plus2_Click(System::Object^ sender, System::EventArgs^ e) {
  466. inputValue->Text = inputNum(2, inputValue->Text);
  467. }
  468. private: System::Void plus3_Click(System::Object^ sender, System::EventArgs^ e) {
  469. inputValue->Text = inputNum(3, inputValue->Text);
  470. }
  471. private: System::Void plus4_Click(System::Object^ sender, System::EventArgs^ e) {
  472. inputValue->Text = inputNum(4, inputValue->Text);
  473. }
  474. private: System::Void plus5_Click(System::Object^ sender, System::EventArgs^ e) {
  475. inputValue->Text = inputNum(5, inputValue->Text);
  476. }
  477. private: System::Void plus6_Click(System::Object^ sender, System::EventArgs^ e) {
  478. inputValue->Text = inputNum(6, inputValue->Text);
  479. }
  480. private: System::Void plus7_Click(System::Object^ sender, System::EventArgs^ e) {
  481. inputValue->Text = inputNum(7, inputValue->Text);
  482. }
  483. private: System::Void plus8_Click(System::Object^ sender, System::EventArgs^ e) {
  484. inputValue->Text = inputNum(8, inputValue->Text);
  485. }
  486. private: System::Void plus9_Click(System::Object^ sender, System::EventArgs^ e) {
  487. inputValue->Text = inputNum(9, inputValue->Text);
  488. }
  489. private: System::Void addDot_Click(System::Object^ sender, System::EventArgs^ e) {
  490. if (!inputValue->Text->Contains(","))
  491. {
  492. if (inputValue->Text->Length > 0)
  493. inputValue->Text = inputValue->Text + ",";
  494. else
  495. inputValue->Text = inputValue->Text + "0,";
  496. }
  497. }
  498. //Кнопки операций
  499. private: System::Void equal_Click(System::Object^ sender, System::EventArgs^ e) {
  500. if (bufferNum->TextLength > 0 && inputValue->TextLength > 0)
  501. {
  502. inputValue->Text = conversion(bufferNum->Text, inputValue->Text, getOperator(opperatorBox->Text));
  503. bufferNum->Text = "";
  504. opperatorBox->Text = "";
  505. }
  506. }
  507. private: System::Void Summ_Click(System::Object^ sender, System::EventArgs^ e) {
  508. if (inputValue->TextLength > 0)
  509. {
  510. if (inputValue->TextLength > 0)
  511. {
  512. if (bufferNum->TextLength > 0)
  513. bufferNum->Text = conversion(bufferNum->Text, inputValue->Text, getOperator(opperatorBox->Text));
  514. else
  515. bufferNum->Text = inputValue->Text;
  516. inputValue->Text = "";
  517. opperatorBox->Text = "+";
  518. }
  519. }
  520. }
  521. private: System::Void diff_Click(System::Object^ sender, System::EventArgs^ e) {
  522. {
  523. if (inputValue->TextLength > 0)
  524. {
  525. if (bufferNum->TextLength > 0)
  526. bufferNum->Text = conversion(bufferNum->Text, inputValue->Text, getOperator(opperatorBox->Text));
  527. else
  528. bufferNum->Text = inputValue->Text;
  529. inputValue->Text = "";
  530. opperatorBox->Text = "-";
  531. }
  532. }
  533. }
  534. private: System::Void multip_Click(System::Object^ sender, System::EventArgs^ e)
  535. {
  536. if (inputValue->TextLength > 0)
  537. {
  538. if (bufferNum->TextLength > 0)
  539. bufferNum->Text = conversion(bufferNum->Text, inputValue->Text, getOperator(opperatorBox->Text));
  540. else
  541. bufferNum->Text = inputValue->Text;
  542. inputValue->Text = "";
  543. opperatorBox->Text = "*";
  544. }
  545. }
  546. private: System::Void disvion_Click(System::Object^ sender, System::EventArgs^ e) {
  547. if (inputValue->TextLength > 0)
  548. {
  549. if (bufferNum->Text != "0")
  550. {
  551. if (bufferNum->TextLength > 0 )
  552. bufferNum->Text = conversion(bufferNum->Text, inputValue->Text, getOperator(opperatorBox->Text));
  553. else
  554. bufferNum->Text = inputValue->Text;
  555. inputValue->Text = "";
  556. opperatorBox->Text = "/";
  557. }
  558. }
  559. }
  560. //Кнопки управления
  561. private: System::Void reset_Click(System::Object^ sender, System::EventArgs^ e) {
  562. inputValue->Text = "";
  563. bufferNum->Text = "";
  564. opperatorBox->Text = "";
  565. }
  566. private: System::Void sign_Click(System::Object^ sender, System::EventArgs^ e) {
  567. if (inputValue->TextLength > 0)
  568. inputValue->Text = Convert::ToString(Convert::ToDouble(inputValue->Text) * -1);
  569. else if (bufferNum->TextLength > 0)
  570. bufferNum->Text = Convert::ToString(Convert::ToDouble(bufferNum->Text) * -1);
  571. }
  572. private: System::Void resetCurrent_Click(System::Object^ sender, System::EventArgs^ e) {
  573. if (inputValue->TextLength > 0)
  574. inputValue->Text = "";
  575. }
  576. };
  577. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement