constk

Fuck_this_shit_I_am_out

Feb 24th, 2020
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.08 KB | None | 0 0
  1. #pragma once
  2.  
  3. namespace ConsoleApplication1 {
  4.  
  5. using namespace System;
  6. using namespace System::ComponentModel;
  7. using namespace System::Collections;
  8. using namespace System::Windows::Forms;
  9. using namespace System::Data;
  10. using namespace System::Drawing;
  11.  
  12. /// <summary>
  13. /// Сводка для Figure
  14. /// </summary>
  15. public ref class Figure : public System::Windows::Forms::Form
  16. {
  17. public:
  18. Figure(void)
  19. {
  20. InitializeComponent();
  21. //
  22. //TODO: добавьте код конструктора
  23. //
  24. this->savingAllowed = false;
  25. this->path = "non";//значение пути к файлу по умолчанию
  26. this->time = DateTime::Now;
  27. toolStripStatusLabel1->Text = System::Convert::ToString(time);
  28. }
  29.  
  30. protected:
  31. /// <summary>
  32. /// Освободить все используемые ресурсы.
  33. /// </summary>
  34. ~Figure()
  35. {
  36. if (components)
  37. {
  38. delete components;
  39. }
  40. }
  41. private: System::Windows::Forms::MenuStrip^ menuStrip1;
  42. protected:
  43. private: System::Windows::Forms::ToolStripMenuItem^ fileToolStripMenuItem;
  44. private: System::Windows::Forms::ToolStripMenuItem^ правкаToolStripMenuItem;
  45.  
  46.  
  47. private: System::Windows::Forms::ToolStripMenuItem^ справкаToolStripMenuItem;
  48. private: System::Windows::Forms::ToolStripMenuItem^ создатьToolStripMenuItem;
  49. private: System::Windows::Forms::ToolStripMenuItem^ открытьToolStripMenuItem;
  50. private: System::Windows::Forms::ToolStripMenuItem^ сохранитьToolStripMenuItem;
  51. private: System::Windows::Forms::ToolStripMenuItem^ сохранитьКакToolStripMenuItem;
  52. private: System::Windows::Forms::ToolStripMenuItem^ выходToolStripMenuItem;
  53. private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator1;
  54. private: System::Windows::Forms::TextBox^ textBox1;
  55. private: System::Windows::Forms::ToolStripMenuItem^ отменитьToolStripMenuItem;
  56. private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator4;
  57. private: System::Windows::Forms::ToolStripMenuItem^ вырезатьToolStripMenuItem;
  58. private: System::Windows::Forms::ToolStripMenuItem^ копироватьToolStripMenuItem;
  59. private: System::Windows::Forms::ToolStripMenuItem^ вставитьToolStripMenuItem;
  60. private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator2;
  61. private: System::Windows::Forms::ToolStripMenuItem^ поискToolStripMenuItem;
  62. private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator3;
  63. private: System::Windows::Forms::ToolStripMenuItem^ выделитьВсёToolStripMenuItem;
  64. private: System::Windows::Forms::ToolStripMenuItem^ вставитьДатуИВремяToolStripMenuItem;
  65. private: System::Windows::Forms::ToolStripMenuItem^ справкаToolStripMenuItem1;
  66. private: System::Windows::Forms::StatusStrip^ statusStrip1;
  67. private: System::Windows::Forms::OpenFileDialog^ openFileDialog1;
  68. private: System::Windows::Forms::SaveFileDialog^ saveFileDialog1;
  69.  
  70. private:
  71. /// <summary>
  72. /// Обязательная переменная конструктора.
  73. /// </summary>
  74. System::ComponentModel::Container ^components;
  75.  
  76. //Мои поля
  77. private:
  78. String ^path;
  79. bool savingAllowed;
  80. private: System::Windows::Forms::ToolStripStatusLabel^ toolStripStatusLabel1;
  81. DateTime ^time;
  82.  
  83. #pragma region Windows Form Designer generated code
  84. /// <summary>
  85. /// Требуемый метод для поддержки конструктора — не изменяйте
  86. /// содержимое этого метода с помощью редактора кода.
  87. /// </summary>
  88. void InitializeComponent(void)
  89. {
  90. System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Figure::typeid));
  91. this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
  92. this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  93. this->создатьToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  94. this->открытьToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  95. this->сохранитьToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  96. this->сохранитьКакToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  97. this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator());
  98. this->выходToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  99. this->правкаToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  100. this->отменитьToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  101. this->toolStripSeparator4 = (gcnew System::Windows::Forms::ToolStripSeparator());
  102. this->вырезатьToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  103. this->копироватьToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  104. this->вставитьToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  105. this->toolStripSeparator2 = (gcnew System::Windows::Forms::ToolStripSeparator());
  106. this->поискToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  107. this->toolStripSeparator3 = (gcnew System::Windows::Forms::ToolStripSeparator());
  108. this->выделитьВсёToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  109. this->вставитьДатуИВремяToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  110. this->справкаToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  111. this->справкаToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
  112. this->textBox1 = (gcnew System::Windows::Forms::TextBox());
  113. this->statusStrip1 = (gcnew System::Windows::Forms::StatusStrip());
  114. this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
  115. this->saveFileDialog1 = (gcnew System::Windows::Forms::SaveFileDialog());
  116. this->toolStripStatusLabel1 = (gcnew System::Windows::Forms::ToolStripStatusLabel());
  117. this->menuStrip1->SuspendLayout();
  118. this->statusStrip1->SuspendLayout();
  119. this->SuspendLayout();
  120. //
  121. // menuStrip1
  122. //
  123. this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(3) {
  124. this->fileToolStripMenuItem,
  125. this->правкаToolStripMenuItem, this->справкаToolStripMenuItem
  126. });
  127. this->menuStrip1->Location = System::Drawing::Point(0, 0);
  128. this->menuStrip1->Name = L"menuStrip1";
  129. this->menuStrip1->Size = System::Drawing::Size(1437, 24);
  130. this->menuStrip1->TabIndex = 0;
  131. this->menuStrip1->Text = L"menuStrip1";
  132. //
  133. // fileToolStripMenuItem
  134. //
  135. this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(6) {
  136. this->создатьToolStripMenuItem,
  137. this->открытьToolStripMenuItem, this->сохранитьToolStripMenuItem, this->сохранитьКакToolStripMenuItem, this->toolStripSeparator1,
  138. this->выходToolStripMenuItem
  139. });
  140. this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";
  141. this->fileToolStripMenuItem->Size = System::Drawing::Size(48, 20);
  142. this->fileToolStripMenuItem->Text = L"Файл";
  143. //
  144. // создатьToolStripMenuItem
  145. //
  146. this->создатьToolStripMenuItem->Name = L"создатьToolStripMenuItem";
  147. this->создатьToolStripMenuItem->ShortcutKeys = static_cast<System::Windows::Forms::Keys>((System::Windows::Forms::Keys::Control | System::Windows::Forms::Keys::N));
  148. this->создатьToolStripMenuItem->Size = System::Drawing::Size(172, 22);
  149. this->создатьToolStripMenuItem->Text = L"Создать";
  150. this->создатьToolStripMenuItem->Click += gcnew System::EventHandler(this, &Figure::создатьToolStripMenuItem_Click);
  151. //
  152. // открытьToolStripMenuItem
  153. //
  154. this->открытьToolStripMenuItem->Name = L"открытьToolStripMenuItem";
  155. this->открытьToolStripMenuItem->ShortcutKeys = static_cast<System::Windows::Forms::Keys>((System::Windows::Forms::Keys::Control | System::Windows::Forms::Keys::O));
  156. this->открытьToolStripMenuItem->Size = System::Drawing::Size(172, 22);
  157. this->открытьToolStripMenuItem->Text = L"Открыть";
  158. this->открытьToolStripMenuItem->Click += gcnew System::EventHandler(this, &Figure::открытьToolStripMenuItem_Click);
  159. //
  160. // сохранитьToolStripMenuItem
  161. //
  162. this->сохранитьToolStripMenuItem->Name = L"сохранитьToolStripMenuItem";
  163. this->сохранитьToolStripMenuItem->ShortcutKeys = static_cast<System::Windows::Forms::Keys>((System::Windows::Forms::Keys::Control | System::Windows::Forms::Keys::S));
  164. this->сохранитьToolStripMenuItem->Size = System::Drawing::Size(172, 22);
  165. this->сохранитьToolStripMenuItem->Text = L"Сохранить";
  166. this->сохранитьToolStripMenuItem->Click += gcnew System::EventHandler(this, &Figure::сохранитьToolStripMenuItem_Click);
  167. //
  168. // сохранитьКакToolStripMenuItem
  169. //
  170. this->сохранитьКакToolStripMenuItem->Name = L"сохранитьКакToolStripMenuItem";
  171. this->сохранитьКакToolStripMenuItem->Size = System::Drawing::Size(172, 22);
  172. this->сохранитьКакToolStripMenuItem->Text = L"Сохранить как";
  173. this->сохранитьКакToolStripMenuItem->Click += gcnew System::EventHandler(this, &Figure::сохранитьКакToolStripMenuItem_Click);
  174. //
  175. // toolStripSeparator1
  176. //
  177. this->toolStripSeparator1->Name = L"toolStripSeparator1";
  178. this->toolStripSeparator1->Size = System::Drawing::Size(169, 6);
  179. //
  180. // выходToolStripMenuItem
  181. //
  182. this->выходToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"выходToolStripMenuItem.Image")));
  183. this->выходToolStripMenuItem->Name = L"выходToolStripMenuItem";
  184. this->выходToolStripMenuItem->Size = System::Drawing::Size(172, 22);
  185. this->выходToolStripMenuItem->Text = L"Выход";
  186. this->выходToolStripMenuItem->Click += gcnew System::EventHandler(this, &Figure::выходToolStripMenuItem_Click);
  187. //
  188. // правкаToolStripMenuItem
  189. //
  190. this->правкаToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(10) {
  191. this->отменитьToolStripMenuItem,
  192. this->toolStripSeparator4, this->вырезатьToolStripMenuItem, this->копироватьToolStripMenuItem, this->вставитьToolStripMenuItem,
  193. this->toolStripSeparator2, this->поискToolStripMenuItem, this->toolStripSeparator3, this->выделитьВсёToolStripMenuItem, this->вставитьДатуИВремяToolStripMenuItem
  194. });
  195. this->правкаToolStripMenuItem->Name = L"правкаToolStripMenuItem";
  196. this->правкаToolStripMenuItem->Size = System::Drawing::Size(59, 20);
  197. this->правкаToolStripMenuItem->Text = L"Правка";
  198. //
  199. // отменитьToolStripMenuItem
  200. //
  201. this->отменитьToolStripMenuItem->Name = L"отменитьToolStripMenuItem";
  202. this->отменитьToolStripMenuItem->ShortcutKeys = static_cast<System::Windows::Forms::Keys>((System::Windows::Forms::Keys::Control | System::Windows::Forms::Keys::Z));
  203. this->отменитьToolStripMenuItem->Size = System::Drawing::Size(214, 22);
  204. this->отменитьToolStripMenuItem->Text = L"Отменить";
  205. this->отменитьToolStripMenuItem->Click += gcnew System::EventHandler(this, &Figure::отменитьToolStripMenuItem_Click);
  206. //
  207. // toolStripSeparator4
  208. //
  209. this->toolStripSeparator4->Name = L"toolStripSeparator4";
  210. this->toolStripSeparator4->Size = System::Drawing::Size(211, 6);
  211. //
  212. // вырезатьToolStripMenuItem
  213. //
  214. this->вырезатьToolStripMenuItem->Name = L"вырезатьToolStripMenuItem";
  215. this->вырезатьToolStripMenuItem->ShortcutKeys = static_cast<System::Windows::Forms::Keys>((System::Windows::Forms::Keys::Control | System::Windows::Forms::Keys::X));
  216. this->вырезатьToolStripMenuItem->Size = System::Drawing::Size(214, 22);
  217. this->вырезатьToolStripMenuItem->Text = L"Вырезать";
  218. this->вырезатьToolStripMenuItem->Click += gcnew System::EventHandler(this, &Figure::вырезатьToolStripMenuItem_Click);
  219. //
  220. // копироватьToolStripMenuItem
  221. //
  222. this->копироватьToolStripMenuItem->Name = L"копироватьToolStripMenuItem";
  223. this->копироватьToolStripMenuItem->ShortcutKeys = static_cast<System::Windows::Forms::Keys>((System::Windows::Forms::Keys::Control | System::Windows::Forms::Keys::C));
  224. this->копироватьToolStripMenuItem->Size = System::Drawing::Size(214, 22);
  225. this->копироватьToolStripMenuItem->Text = L"Копировать";
  226. this->копироватьToolStripMenuItem->Click += gcnew System::EventHandler(this, &Figure::копироватьToolStripMenuItem_Click);
  227. //
  228. // вставитьToolStripMenuItem
  229. //
  230. this->вставитьToolStripMenuItem->Name = L"вставитьToolStripMenuItem";
  231. this->вставитьToolStripMenuItem->ShortcutKeys = static_cast<System::Windows::Forms::Keys>((System::Windows::Forms::Keys::Control | System::Windows::Forms::Keys::V));
  232. this->вставитьToolStripMenuItem->Size = System::Drawing::Size(214, 22);
  233. this->вставитьToolStripMenuItem->Text = L"Вставить";
  234. this->вставитьToolStripMenuItem->Click += gcnew System::EventHandler(this, &Figure::вставитьToolStripMenuItem_Click);
  235. //
  236. // toolStripSeparator2
  237. //
  238. this->toolStripSeparator2->Name = L"toolStripSeparator2";
  239. this->toolStripSeparator2->Size = System::Drawing::Size(211, 6);
  240. //
  241. // поискToolStripMenuItem
  242. //
  243. this->поискToolStripMenuItem->Name = L"поискToolStripMenuItem";
  244. this->поискToolStripMenuItem->ShortcutKeys = static_cast<System::Windows::Forms::Keys>((System::Windows::Forms::Keys::Control | System::Windows::Forms::Keys::F));
  245. this->поискToolStripMenuItem->Size = System::Drawing::Size(214, 22);
  246. this->поискToolStripMenuItem->Text = L"Поиск...";
  247. this->поискToolStripMenuItem->Click += gcnew System::EventHandler(this, &Figure::поискToolStripMenuItem_Click);
  248. //
  249. // toolStripSeparator3
  250. //
  251. this->toolStripSeparator3->Name = L"toolStripSeparator3";
  252. this->toolStripSeparator3->Size = System::Drawing::Size(211, 6);
  253. //
  254. // выделитьВсёToolStripMenuItem
  255. //
  256. this->выделитьВсёToolStripMenuItem->Name = L"выделитьВсёToolStripMenuItem";
  257. this->выделитьВсёToolStripMenuItem->ShortcutKeys = static_cast<System::Windows::Forms::Keys>((System::Windows::Forms::Keys::Control | System::Windows::Forms::Keys::A));
  258. this->выделитьВсёToolStripMenuItem->Size = System::Drawing::Size(214, 22);
  259. this->выделитьВсёToolStripMenuItem->Text = L"Выделить всё";
  260. this->выделитьВсёToolStripMenuItem->Click += gcnew System::EventHandler(this, &Figure::выделитьВсёToolStripMenuItem_Click);
  261. //
  262. // вставитьДатуИВремяToolStripMenuItem
  263. //
  264. this->вставитьДатуИВремяToolStripMenuItem->Name = L"вставитьДатуИВремяToolStripMenuItem";
  265. this->вставитьДатуИВремяToolStripMenuItem->ShortcutKeys = System::Windows::Forms::Keys::F5;
  266. this->вставитьДатуИВремяToolStripMenuItem->Size = System::Drawing::Size(214, 22);
  267. this->вставитьДатуИВремяToolStripMenuItem->Text = L"Вставить дату и время";
  268. this->вставитьДатуИВремяToolStripMenuItem->Click += gcnew System::EventHandler(this, &Figure::вставитьДатуИВремяToolStripMenuItem_Click);
  269. //
  270. // справкаToolStripMenuItem
  271. //
  272. this->справкаToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) { this->справкаToolStripMenuItem1 });
  273. this->справкаToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"справкаToolStripMenuItem.Image")));
  274. this->справкаToolStripMenuItem->Name = L"справкаToolStripMenuItem";
  275. this->справкаToolStripMenuItem->ShortcutKeys = System::Windows::Forms::Keys::F1;
  276. this->справкаToolStripMenuItem->Size = System::Drawing::Size(110, 20);
  277. this->справкаToolStripMenuItem->Text = L"О программе";
  278. //
  279. // справкаToolStripMenuItem1
  280. //
  281. this->справкаToolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"справкаToolStripMenuItem1.Image")));
  282. this->справкаToolStripMenuItem1->Name = L"справкаToolStripMenuItem1";
  283. this->справкаToolStripMenuItem1->ShortcutKeys = System::Windows::Forms::Keys::F1;
  284. this->справкаToolStripMenuItem1->Size = System::Drawing::Size(139, 22);
  285. this->справкаToolStripMenuItem1->Text = L"Справка";
  286. this->справкаToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Figure::справкаToolStripMenuItem1_Click);
  287. //
  288. // textBox1
  289. //
  290. this->textBox1->Location = System::Drawing::Point(13, 28);
  291. this->textBox1->Multiline = true;
  292. this->textBox1->Name = L"textBox1";
  293. this->textBox1->Size = System::Drawing::Size(1253, 581);
  294. this->textBox1->TabIndex = 1;
  295. //
  296. // statusStrip1
  297. //
  298. this->statusStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) { this->toolStripStatusLabel1 });
  299. this->statusStrip1->Location = System::Drawing::Point(0, 699);
  300. this->statusStrip1->Name = L"statusStrip1";
  301. this->statusStrip1->Size = System::Drawing::Size(1437, 22);
  302. this->statusStrip1->TabIndex = 2;
  303. this->statusStrip1->Text = L"statusStrip1";
  304. //
  305. // openFileDialog1
  306. //
  307. this->openFileDialog1->FileName = L"openFileDialog1";
  308. this->openFileDialog1->Filter = L"Текстовые файлы|*.txt|Все файлы|*.*";
  309. //
  310. // saveFileDialog1
  311. //
  312. this->saveFileDialog1->Filter = L"Текстовый файл|*.txt";
  313. //
  314. // toolStripStatusLabel1
  315. //
  316. this->toolStripStatusLabel1->Name = L"toolStripStatusLabel1";
  317. this->toolStripStatusLabel1->Size = System::Drawing::Size(118, 17);
  318. this->toolStripStatusLabel1->Text = L"toolStripStatusLabel1";
  319. //
  320. // Figure
  321. //
  322. this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
  323. this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
  324. this->ClientSize = System::Drawing::Size(1437, 721);
  325. this->Controls->Add(this->statusStrip1);
  326. this->Controls->Add(this->textBox1);
  327. this->Controls->Add(this->menuStrip1);
  328. this->Icon = (cli::safe_cast<System::Drawing::Icon^>(resources->GetObject(L"$this.Icon")));
  329. this->MainMenuStrip = this->menuStrip1;
  330. this->Name = L"Figure";
  331. this->Text = L"Figure";
  332. this->menuStrip1->ResumeLayout(false);
  333. this->menuStrip1->PerformLayout();
  334. this->statusStrip1->ResumeLayout(false);
  335. this->statusStrip1->PerformLayout();
  336. this->ResumeLayout(false);
  337. this->PerformLayout();
  338.  
  339. }
  340.  
  341. #pragma endregion
  342.  
  343. private: System::Void создатьToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
  344. {
  345. //textBox1->Text = "";
  346. if (!(textBox1->Text->IsNullOrEmpty(textBox1->Text->ToString())))
  347. {
  348. if (saveFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)
  349. {
  350. this->path = saveFileDialog1->FileName;
  351. this->savingAllowed = true;
  352.  
  353. System::IO::File::WriteAllText(
  354. path, textBox1->Text, System::Text::Encoding::GetEncoding(1251)
  355. );
  356.  
  357. this->time = DateTime::Now;
  358. toolStripStatusLabel1->Text = System::Convert::ToString(time);
  359. }
  360. }
  361. }
  362.  
  363. private: System::Void выходToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
  364. {
  365. System::Windows::Forms::DialogResult ee;
  366.  
  367. ee = MessageBox::Show("Точно выйти?", "Внимание!", MessageBoxButtons::YesNo, MessageBoxIcon::Question);
  368.  
  369. if (ee == System::Windows::Forms::DialogResult::Yes)
  370. {
  371. this->Close();
  372. }
  373. }
  374.  
  375. private: System::Void открытьToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
  376. {
  377. if (openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)
  378. {
  379. textBox1->Text =
  380. System::IO::File::ReadAllText(
  381. openFileDialog1->FileName, System::Text::Encoding::GetEncoding(1251)
  382. );
  383. path = openFileDialog1->FileName;
  384. savingAllowed = true;
  385. }
  386. }
  387.  
  388. private: System::Void сохранитьToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
  389. {
  390. if (this->savingAllowed && this->path != "non")
  391. {
  392. System::IO::File::WriteAllText(
  393. path, textBox1->Text, System::Text::Encoding::GetEncoding(1251)
  394. );
  395.  
  396. this->time = DateTime::Now;
  397. toolStripStatusLabel1->Text = System::Convert::ToString(time);
  398. }
  399. else
  400. {
  401. this->path = saveFileDialog1->FileName;
  402. this->savingAllowed = true;
  403.  
  404. System::IO::File::WriteAllText(
  405. path, textBox1->Text, System::Text::Encoding::GetEncoding(1251)
  406. );
  407.  
  408. this->time = DateTime::Now;
  409. toolStripStatusLabel1->Text = System::Convert::ToString(time);
  410. }
  411. }
  412.  
  413. private: System::Void сохранитьКакToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
  414. {
  415. if (saveFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)
  416. {
  417. this->path = saveFileDialog1->FileName;
  418. this->savingAllowed = true;
  419.  
  420. System::IO::File::WriteAllText(
  421. path, textBox1->Text, System::Text::Encoding::GetEncoding(1251)
  422. );
  423.  
  424. this->time = DateTime::Now;
  425. toolStripStatusLabel1->Text = System::Convert::ToString(time);
  426. }
  427. }
  428.  
  429. private: System::Void отменитьToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
  430. {
  431. textBox1->Undo();
  432. }
  433.  
  434. private: System::Void вырезатьToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
  435. {
  436. textBox1->Cut();
  437. }
  438.  
  439. private: System::Void копироватьToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
  440. {
  441. textBox1->Copy();
  442. }
  443.  
  444. private: System::Void вставитьToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
  445. {
  446. textBox1->Paste();
  447. }
  448.  
  449. private: System::Void поискToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
  450. {
  451. /* */
  452. }
  453.  
  454. private: System::Void выделитьВсёToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
  455. {
  456. textBox1->SelectAll();
  457. }
  458.  
  459. private: System::Void вставитьДатуИВремяToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
  460. {
  461. this->time = DateTime::Now;
  462. toolStripStatusLabel1->Text = System::Convert::ToString(time);
  463. }
  464.  
  465. private: System::Void справкаToolStripMenuItem1_Click(System::Object^ sender, System::EventArgs^ e)
  466. {
  467.  
  468. }
  469. };
  470. }
Add Comment
Please, Sign In to add comment