diff --git a/App.config b/App.config new file mode 100644 index 0000000..193aecc --- /dev/null +++ b/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Form1.Designer.cs b/Form1.Designer.cs new file mode 100644 index 0000000..9d8d01c --- /dev/null +++ b/Form1.Designer.cs @@ -0,0 +1,539 @@ +namespace WindowsFormsApp4 +{ + partial class Form1 + { + /// + /// Обязательная переменная конструктора. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором форм Windows + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + private void InitializeComponent() + { + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.файлToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.открытьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.сохранитьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.выйтиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.panel1 = new System.Windows.Forms.Panel(); + this.button13 = new System.Windows.Forms.Button(); + this.button12 = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.button11 = new System.Windows.Forms.Button(); + this.checkBox2 = new System.Windows.Forms.CheckBox(); + this.label2 = new System.Windows.Forms.Label(); + this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.listBox3 = new System.Windows.Forms.ListBox(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.button10 = new System.Windows.Forms.Button(); + this.button9 = new System.Windows.Forms.Button(); + this.button8 = new System.Windows.Forms.Button(); + this.button7 = new System.Windows.Forms.Button(); + this.button6 = new System.Windows.Forms.Button(); + this.button5 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button1 = new System.Windows.Forms.Button(); + this.listBox2 = new System.Windows.Forms.ListBox(); + this.listBox1 = new System.Windows.Forms.ListBox(); + this.comboBox2 = new System.Windows.Forms.ComboBox(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.label1 = new System.Windows.Forms.Label(); + this.richTextBox1 = new System.Windows.Forms.RichTextBox(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.button14 = new System.Windows.Forms.Button(); + this.radioButton3 = new System.Windows.Forms.RadioButton(); + this.radioButton2 = new System.Windows.Forms.RadioButton(); + this.radioButton1 = new System.Windows.Forms.RadioButton(); + this.label3 = new System.Windows.Forms.Label(); + this.menuStrip1.SuspendLayout(); + this.panel1.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.файлToolStripMenuItem, + this.toolStripMenuItem1}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(658, 24); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + // + // файлToolStripMenuItem + // + this.файлToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.открытьToolStripMenuItem, + this.сохранитьToolStripMenuItem, + this.выйтиToolStripMenuItem}); + this.файлToolStripMenuItem.Name = "файлToolStripMenuItem"; + this.файлToolStripMenuItem.Size = new System.Drawing.Size(48, 20); + this.файлToolStripMenuItem.Text = "Файл"; + // + // открытьToolStripMenuItem + // + this.открытьToolStripMenuItem.Name = "открытьToolStripMenuItem"; + this.открытьToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); + this.открытьToolStripMenuItem.Size = new System.Drawing.Size(184, 22); + this.открытьToolStripMenuItem.Text = "Открыть"; + this.открытьToolStripMenuItem.Click += new System.EventHandler(this.открытьToolStripMenuItem_Click); + // + // сохранитьToolStripMenuItem + // + this.сохранитьToolStripMenuItem.Name = "сохранитьToolStripMenuItem"; + this.сохранитьToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); + this.сохранитьToolStripMenuItem.Size = new System.Drawing.Size(184, 22); + this.сохранитьToolStripMenuItem.Text = "Сохранить "; + this.сохранитьToolStripMenuItem.Click += new System.EventHandler(this.сохранитьToolStripMenuItem_Click); + // + // выйтиToolStripMenuItem + // + this.выйтиToolStripMenuItem.Name = "выйтиToolStripMenuItem"; + this.выйтиToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.X))); + this.выйтиToolStripMenuItem.Size = new System.Drawing.Size(184, 22); + this.выйтиToolStripMenuItem.Text = "Выйти"; + this.выйтиToolStripMenuItem.Click += new System.EventHandler(this.выйтиToolStripMenuItem_Click); + // + // toolStripMenuItem1 + // + this.toolStripMenuItem1.Name = "toolStripMenuItem1"; + this.toolStripMenuItem1.Size = new System.Drawing.Size(24, 20); + this.toolStripMenuItem1.Text = "?"; + this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click); + // + // panel1 + // + this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panel1.Controls.Add(this.label3); + this.panel1.Controls.Add(this.button13); + this.panel1.Controls.Add(this.button12); + this.panel1.Controls.Add(this.groupBox1); + this.panel1.Controls.Add(this.button10); + this.panel1.Controls.Add(this.button9); + this.panel1.Controls.Add(this.button8); + this.panel1.Controls.Add(this.button7); + this.panel1.Controls.Add(this.button6); + this.panel1.Controls.Add(this.button5); + this.panel1.Controls.Add(this.button4); + this.panel1.Controls.Add(this.button3); + this.panel1.Controls.Add(this.button2); + this.panel1.Controls.Add(this.button1); + this.panel1.Controls.Add(this.listBox2); + this.panel1.Controls.Add(this.listBox1); + this.panel1.Controls.Add(this.comboBox2); + this.panel1.Controls.Add(this.comboBox1); + this.panel1.Controls.Add(this.label1); + this.panel1.Location = new System.Drawing.Point(11, 27); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(390, 411); + this.panel1.TabIndex = 1; + // + // button13 + // + this.button13.Location = new System.Drawing.Point(253, 343); + this.button13.Name = "button13"; + this.button13.Size = new System.Drawing.Size(114, 62); + this.button13.TabIndex = 17; + this.button13.Text = "Выход"; + this.button13.UseVisualStyleBackColor = true; + this.button13.Click += new System.EventHandler(this.button13_Click); + // + // button12 + // + this.button12.Location = new System.Drawing.Point(253, 276); + this.button12.Name = "button12"; + this.button12.Size = new System.Drawing.Size(114, 62); + this.button12.TabIndex = 16; + this.button12.Text = "Сброс"; + this.button12.UseVisualStyleBackColor = true; + this.button12.Click += new System.EventHandler(this.button12_Click); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.button11); + this.groupBox1.Controls.Add(this.checkBox2); + this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Controls.Add(this.checkBox1); + this.groupBox1.Controls.Add(this.listBox3); + this.groupBox1.Controls.Add(this.textBox1); + this.groupBox1.Location = new System.Drawing.Point(8, 272); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(226, 134); + this.groupBox1.TabIndex = 15; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Поиск"; + // + // button11 + // + this.button11.Location = new System.Drawing.Point(140, 77); + this.button11.Name = "button11"; + this.button11.Size = new System.Drawing.Size(72, 49); + this.button11.TabIndex = 18; + this.button11.Text = "Поиск"; + this.button11.UseVisualStyleBackColor = true; + this.button11.Click += new System.EventHandler(this.button11_Click); + // + // checkBox2 + // + this.checkBox2.AutoSize = true; + this.checkBox2.Location = new System.Drawing.Point(140, 54); + this.checkBox2.Name = "checkBox2"; + this.checkBox2.Size = new System.Drawing.Size(72, 17); + this.checkBox2.TabIndex = 17; + this.checkBox2.Text = "Раздел 2"; + this.checkBox2.UseVisualStyleBackColor = true; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(1, 15); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(129, 13); + this.label2.TabIndex = 2; + this.label2.Text = "Введите искомое слово"; + // + // checkBox1 + // + this.checkBox1.AutoSize = true; + this.checkBox1.Checked = true; + this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBox1.Location = new System.Drawing.Point(140, 31); + this.checkBox1.Name = "checkBox1"; + this.checkBox1.Size = new System.Drawing.Size(72, 17); + this.checkBox1.TabIndex = 16; + this.checkBox1.Text = "Раздел 1"; + this.checkBox1.UseVisualStyleBackColor = true; + // + // listBox3 + // + this.listBox3.FormattingEnabled = true; + this.listBox3.Location = new System.Drawing.Point(4, 57); + this.listBox3.Name = "listBox3"; + this.listBox3.Size = new System.Drawing.Size(126, 69); + this.listBox3.TabIndex = 1; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(4, 31); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(126, 20); + this.textBox1.TabIndex = 0; + // + // button10 + // + this.button10.Location = new System.Drawing.Point(282, 221); + this.button10.Name = "button10"; + this.button10.Size = new System.Drawing.Size(80, 23); + this.button10.TabIndex = 14; + this.button10.Text = "Очистить"; + this.button10.UseVisualStyleBackColor = true; + this.button10.Click += new System.EventHandler(this.button10_Click); + // + // button9 + // + this.button9.Location = new System.Drawing.Point(282, 192); + this.button9.Name = "button9"; + this.button9.Size = new System.Drawing.Size(80, 23); + this.button9.TabIndex = 13; + this.button9.Text = "Сортировать"; + this.button9.UseVisualStyleBackColor = true; + this.button9.Click += new System.EventHandler(this.button9_Click); + // + // button8 + // + this.button8.Location = new System.Drawing.Point(154, 221); + this.button8.Name = "button8"; + this.button8.Size = new System.Drawing.Size(80, 23); + this.button8.TabIndex = 12; + this.button8.Text = "Удалить"; + this.button8.UseVisualStyleBackColor = true; + this.button8.Click += new System.EventHandler(this.button8_Click); + // + // button7 + // + this.button7.Location = new System.Drawing.Point(154, 192); + this.button7.Name = "button7"; + this.button7.Size = new System.Drawing.Size(80, 23); + this.button7.TabIndex = 11; + this.button7.Text = "Добавить"; + this.button7.UseVisualStyleBackColor = true; + this.button7.Click += new System.EventHandler(this.button7_Click); + // + // button6 + // + this.button6.Location = new System.Drawing.Point(28, 221); + this.button6.Name = "button6"; + this.button6.Size = new System.Drawing.Size(80, 23); + this.button6.TabIndex = 10; + this.button6.Text = "Очистить"; + this.button6.UseVisualStyleBackColor = true; + this.button6.Click += new System.EventHandler(this.button6_Click); + // + // button5 + // + this.button5.Location = new System.Drawing.Point(28, 192); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(80, 23); + this.button5.TabIndex = 9; + this.button5.Text = "Сортировать"; + this.button5.UseVisualStyleBackColor = true; + this.button5.Click += new System.EventHandler(this.button5_Click); + // + // button4 + // + this.button4.Location = new System.Drawing.Point(156, 139); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(75, 23); + this.button4.TabIndex = 8; + this.button4.Text = "<<"; + this.button4.UseVisualStyleBackColor = true; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // button3 + // + this.button3.Location = new System.Drawing.Point(156, 110); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(75, 23); + this.button3.TabIndex = 7; + this.button3.Text = ">>"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(156, 81); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.TabIndex = 6; + this.button2.Text = "<"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(156, 52); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 5; + this.button1.Text = ">"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // listBox2 + // + this.listBox2.FormattingEnabled = true; + this.listBox2.Location = new System.Drawing.Point(261, 52); + this.listBox2.Name = "listBox2"; + this.listBox2.Size = new System.Drawing.Size(121, 134); + this.listBox2.TabIndex = 4; + // + // listBox1 + // + this.listBox1.FormattingEnabled = true; + this.listBox1.Location = new System.Drawing.Point(8, 52); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new System.Drawing.Size(121, 134); + this.listBox1.TabIndex = 3; + // + // comboBox2 + // + this.comboBox2.FormattingEnabled = true; + this.comboBox2.Items.AddRange(new object[] { + "По длине ⬇", + "По длине ⬆", + "По алфавиту ⬇", + "По алфавиту ⬆"}); + this.comboBox2.Location = new System.Drawing.Point(261, 25); + this.comboBox2.Name = "comboBox2"; + this.comboBox2.Size = new System.Drawing.Size(121, 21); + this.comboBox2.TabIndex = 2; + this.comboBox2.Text = "Сортировка по..."; + // + // comboBox1 + // + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Items.AddRange(new object[] { + "По длине ⬇", + "По длине ⬆", + "По алфавиту ⬇", + "По алфавиту ⬆"}); + this.comboBox1.Location = new System.Drawing.Point(8, 25); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(121, 21); + this.comboBox1.TabIndex = 1; + this.comboBox1.Text = "Сортировка по..."; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(5, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(53, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Раздел 1"; + // + // richTextBox1 + // + this.richTextBox1.Location = new System.Drawing.Point(407, 27); + this.richTextBox1.Name = "richTextBox1"; + this.richTextBox1.Size = new System.Drawing.Size(241, 301); + this.richTextBox1.TabIndex = 2; + this.richTextBox1.Text = ""; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.button14); + this.groupBox2.Controls.Add(this.radioButton3); + this.groupBox2.Controls.Add(this.radioButton2); + this.groupBox2.Controls.Add(this.radioButton1); + this.groupBox2.Location = new System.Drawing.Point(407, 338); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(241, 100); + this.groupBox2.TabIndex = 3; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Выбор слов"; + // + // button14 + // + this.button14.Location = new System.Drawing.Point(160, 24); + this.button14.Name = "button14"; + this.button14.Size = new System.Drawing.Size(75, 58); + this.button14.TabIndex = 3; + this.button14.Text = "Начать"; + this.button14.UseVisualStyleBackColor = true; + this.button14.Click += new System.EventHandler(this.button14_Click); + // + // radioButton3 + // + this.radioButton3.AutoSize = true; + this.radioButton3.Location = new System.Drawing.Point(6, 65); + this.radioButton3.Name = "radioButton3"; + this.radioButton3.Size = new System.Drawing.Size(131, 17); + this.radioButton3.TabIndex = 2; + this.radioButton3.TabStop = true; + this.radioButton3.Text = "Содержащие \"e-mail\""; + this.radioButton3.UseVisualStyleBackColor = true; + // + // radioButton2 + // + this.radioButton2.AutoSize = true; + this.radioButton2.Location = new System.Drawing.Point(6, 42); + this.radioButton2.Name = "radioButton2"; + this.radioButton2.Size = new System.Drawing.Size(128, 17); + this.radioButton2.TabIndex = 1; + this.radioButton2.TabStop = true; + this.radioButton2.Text = "Содержащие цифры"; + this.radioButton2.UseVisualStyleBackColor = true; + // + // radioButton1 + // + this.radioButton1.AutoSize = true; + this.radioButton1.Checked = true; + this.radioButton1.Location = new System.Drawing.Point(6, 19); + this.radioButton1.Name = "radioButton1"; + this.radioButton1.Size = new System.Drawing.Size(44, 17); + this.radioButton1.TabIndex = 0; + this.radioButton1.TabStop = true; + this.radioButton1.Text = "Все"; + this.radioButton1.UseVisualStyleBackColor = true; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(258, 9); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(53, 13); + this.label3.TabIndex = 18; + this.label3.Text = "Раздел 2"; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(658, 450); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.richTextBox1); + this.Controls.Add(this.panel1); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; + this.Name = "Form1"; + this.Text = "Form1"; + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem файлToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Button button10; + private System.Windows.Forms.Button button9; + private System.Windows.Forms.Button button8; + private System.Windows.Forms.Button button7; + private System.Windows.Forms.Button button6; + private System.Windows.Forms.Button button5; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.ComboBox comboBox2; + private System.Windows.Forms.Button button11; + private System.Windows.Forms.CheckBox checkBox2; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.CheckBox checkBox1; + private System.Windows.Forms.ListBox listBox3; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Button button13; + private System.Windows.Forms.Button button12; + private System.Windows.Forms.RichTextBox richTextBox1; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.Button button14; + private System.Windows.Forms.RadioButton radioButton3; + private System.Windows.Forms.RadioButton radioButton2; + private System.Windows.Forms.RadioButton radioButton1; + private System.Windows.Forms.ToolStripMenuItem открытьToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem сохранитьToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem выйтиToolStripMenuItem; + public System.Windows.Forms.ListBox listBox2; + public System.Windows.Forms.ListBox listBox1; + private System.Windows.Forms.Label label3; + } +} + diff --git a/Form1.cs b/Form1.cs new file mode 100644 index 0000000..89a98f5 --- /dev/null +++ b/Form1.cs @@ -0,0 +1,365 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Text.RegularExpressions; + +namespace WindowsFormsApp4 +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + private void открытьToolStripMenuItem_Click(object sender, EventArgs e) + { + OpenFileDialog OpenDlg = new OpenFileDialog(); + + if (OpenDlg.ShowDialog() == DialogResult.OK) + { + StreamReader Reader = new StreamReader(OpenDlg.FileName, Encoding.UTF8); + richTextBox1.Text = Reader.ReadToEnd(); + Reader.Close(); + } + OpenDlg.Dispose(); + } + + private void сохранитьToolStripMenuItem_Click(object sender, EventArgs e) + { + SaveFileDialog SaveDlg = new SaveFileDialog(); + + SaveDlg.Filter = "Text Files (*.txt)|*.txt|All files (*.*)|*.*"; + SaveDlg.DefaultExt = "txt"; + SaveDlg.FileName = "Новый файл"; + + if (SaveDlg.ShowDialog() == DialogResult.OK) + { + StreamWriter Writer = new StreamWriter(SaveDlg.FileName); + for (int i = 0; i < listBox2.Items.Count; i++) + { + Writer.WriteLine((string)listBox2.Items[i]); + } + Writer.Close(); + } + SaveDlg.Dispose(); + } + + private void выйтиToolStripMenuItem_Click(object sender, EventArgs e) + { + Application.Exit(); + } + + private void toolStripMenuItem1_Click(object sender, EventArgs e) + { + MessageBox.Show("Желонкин Денис Сергеевич ИС-23-1"); + } + + private void button14_Click(object sender, EventArgs e) + { + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox1.BeginUpdate(); + string[] Strings = richTextBox1.Text.Split(new char[] { '\n', '\t', ' ' }, + StringSplitOptions.RemoveEmptyEntries); + foreach (string s in Strings) + { + string Str = s.Trim(); + if (Str == String.Empty) continue; + if (radioButton1.Checked) listBox1.Items.Add(Str); + if (radioButton2.Checked) + { + if (Regex.IsMatch(Str, @"\d")) listBox1.Items.Add(Str); + } + if (radioButton3.Checked) + { + if (Regex.IsMatch(Str, @"\w+@\w+\.\w+")) listBox1.Items.Add(Str); + } + } + listBox1.EndUpdate(); + } + + private void button13_Click(object sender, EventArgs e) + { + Application.Exit(); + } + + private void button12_Click(object sender, EventArgs e) + { + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox3.Items.Clear(); + richTextBox1.Clear(); + textBox1.Clear(); + checkBox1.Checked = false; + checkBox2.Checked = false; + radioButton1.Checked = false; + radioButton2.Checked = false; + radioButton3.Checked = false; + comboBox1.Text = "Сортировка по..."; + comboBox2.Text = "Сортировка по..."; + + } + + private void button11_Click(object sender, EventArgs e) + { + listBox3.Items.Clear(); + string Find = textBox1.Text; + if (checkBox1.Checked) + { + foreach (string String in listBox1.Items) + { + if (String.Contains(Find)) listBox3.Items.Add(String); + } + } + if (checkBox2.Checked) + { + foreach (string String in listBox2.Items) + { + if (String.Contains(Find)) listBox3.Items.Add(String); + } + } + } + + private void button7_Click(object sender, EventArgs e) + { + Form2 AddRec = new Form2(); + AddRec.Owner = this; + AddRec.ShowDialog(); + } + + private void button8_Click(object sender, EventArgs e) + { + for (int i = listBox1.Items.Count - 1; i >= 0; i--) + { + if (listBox1.GetSelected(i)) listBox1.Items.RemoveAt(i); + } + for (int i = listBox2.Items.Count - 1; i >= 0; i--) + { + if (listBox2.GetSelected(i)) listBox2.Items.RemoveAt(i); + } + } + + private void button3_Click(object sender, EventArgs e) + { + listBox2.Items.AddRange(listBox1.Items); + listBox1.Items.Clear(); + } + + private void button4_Click(object sender, EventArgs e) + { + listBox1.Items.AddRange(listBox2.Items); + listBox2.Items.Clear(); + } + + private void button1_Click(object sender, EventArgs e) + { + listBox2.BeginUpdate(); + foreach (object Item in listBox1.SelectedItems) + { + listBox2.Items.Add(Item); + } + listBox2.EndUpdate(); + listBox1.Items.Remove(listBox1.SelectedItem); + } + + private void button2_Click(object sender, EventArgs e) + { + listBox1.BeginUpdate(); + foreach (object Item in listBox2.SelectedItems) + { + listBox1.Items.Add(Item); + } + listBox1.EndUpdate(); + listBox2.Items.Remove(listBox2.SelectedItem); + } + + private void button6_Click(object sender, EventArgs e) + { + listBox1.Items.Clear(); + } + + private void button10_Click(object sender, EventArgs e) + { + listBox2.Items.Clear(); + } + + private void button5_Click(object sender, EventArgs e) + { + if (comboBox1.Text == "По алфавиту ⬇") + { + listBox1.Sorted = true; + } + else if (comboBox1.Text == "По алфавиту ⬆") + { + listBox1.Sorted = false; + List items = new List(); + + foreach (string item in listBox1.Items) + { + items.Add(item); + } + + items.Sort(); + items.Reverse(); + + listBox1.Items.Clear(); + foreach (string item in items) + { + listBox1.Items.Add(item); + } + } + else if (comboBox1.Text == "По длине ⬇") + { + listBox1.Sorted = false; + List items = new List(); + + foreach (string item in listBox1.Items) + { + items.Add(item); + } + + for (int i = 0; i < items.Count - 1; i++) + { + for (int j = i + 1; j < items.Count; j++) + { + if (items[i].Length > items[j].Length) + { + string temp = items[i]; + items[i] = items[j]; + items[j] = temp; + } + } + } + + listBox1.Items.Clear(); + foreach (string item in items) + { + listBox1.Items.Add(item); + } + } + else if (comboBox1.Text == "По длине ⬆") + { + listBox1.Sorted = false; + List items = new List(); + + foreach (string item in listBox1.Items) + { + items.Add(item); + } + + for (int i = 0; i < items.Count - 1; i++) + { + for (int j = i + 1; j < items.Count; j++) + { + if (items[i].Length < items[j].Length) + { + string temp = items[i]; + items[i] = items[j]; + items[j] = temp; + } + } + } + + listBox1.Items.Clear(); + foreach (string item in items) + { + listBox1.Items.Add(item); + } + } + + } + + private void button9_Click(object sender, EventArgs e) + { + if (comboBox2.Text == "По алфавиту ⬇") + { + listBox2.Sorted = true; + } + else if (comboBox2.Text == "По алфавиту ⬆") + { + listBox2.Sorted = false; + List items = new List(); + + foreach (string item in listBox2.Items) + { + items.Add(item); + } + + items.Sort(); + items.Reverse(); + + listBox2.Items.Clear(); + foreach (string item in items) + { + listBox2.Items.Add(item); + } + } + else if (comboBox2.Text == "По длине ⬇") + { + listBox2.Sorted = false; + List items = new List(); + + foreach (string item in listBox2.Items) + { + items.Add(item); + } + + for (int i = 0; i < items.Count - 1; i++) + { + for (int j = i + 1; j < items.Count; j++) + { + if (items[i].Length > items[j].Length) + { + string temp = items[i]; + items[i] = items[j]; + items[j] = temp; + } + } + } + + listBox2.Items.Clear(); + foreach (string item in items) + { + listBox2.Items.Add(item); + } + } + else if (comboBox2.Text == "По длине ⬆") + { + listBox2.Sorted = false; + List items = new List(); + + foreach (string item in listBox2.Items) + { + items.Add(item); + } + + for (int i = 0; i < items.Count - 1; i++) + { + for (int j = i + 1; j < items.Count; j++) + { + if (items[i].Length < items[j].Length) + { + string temp = items[i]; + items[i] = items[j]; + items[j] = temp; + } + } + } + + listBox2.Items.Clear(); + foreach (string item in items) + { + listBox2.Items.Add(item); + } + } + } + } +} diff --git a/Form1.resx b/Form1.resx new file mode 100644 index 0000000..d5494e3 --- /dev/null +++ b/Form1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/Form2.Designer.cs b/Form2.Designer.cs new file mode 100644 index 0000000..fe5676d --- /dev/null +++ b/Form2.Designer.cs @@ -0,0 +1,139 @@ +namespace WindowsFormsApp4 +{ + partial class Form2 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.radioButton1 = new System.Windows.Forms.RadioButton(); + this.radioButton2 = new System.Windows.Forms.RadioButton(); + this.label1 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.radioButton2); + this.groupBox1.Controls.Add(this.radioButton1); + this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(219, 69); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Добавить в..."; + // + // radioButton1 + // + this.radioButton1.AutoSize = true; + this.radioButton1.Location = new System.Drawing.Point(6, 19); + this.radioButton1.Name = "radioButton1"; + this.radioButton1.Size = new System.Drawing.Size(71, 17); + this.radioButton1.TabIndex = 0; + this.radioButton1.TabStop = true; + this.radioButton1.Text = "Раздел 1"; + this.radioButton1.UseVisualStyleBackColor = true; + // + // radioButton2 + // + this.radioButton2.AutoSize = true; + this.radioButton2.Location = new System.Drawing.Point(6, 42); + this.radioButton2.Name = "radioButton2"; + this.radioButton2.Size = new System.Drawing.Size(71, 17); + this.radioButton2.TabIndex = 1; + this.radioButton2.TabStop = true; + this.radioButton2.Text = "Раздел 2"; + this.radioButton2.UseVisualStyleBackColor = true; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(14, 98); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(80, 13); + this.label1.TabIndex = 1; + this.label1.Text = "Введите текст"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(12, 114); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(219, 20); + this.textBox1.TabIndex = 2; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(12, 140); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 3; + this.button1.Text = "Добавить"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(156, 140); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.TabIndex = 4; + this.button2.Text = "Отмена"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // Form2 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(246, 177); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label1); + this.Controls.Add(this.groupBox1); + this.Name = "Form2"; + this.Text = "Form2"; + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.RadioButton radioButton2; + private System.Windows.Forms.RadioButton radioButton1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + } +} \ No newline at end of file diff --git a/Form2.cs b/Form2.cs new file mode 100644 index 0000000..1725a73 --- /dev/null +++ b/Form2.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApp4 +{ + public partial class Form2 : Form + { + public Form2() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + Form1 Main = this.Owner as Form1; + if (textBox1.Text != "") + { + if (this.radioButton1.Checked == true) + Main.listBox1.Items.Add(this.textBox1.Text); + else Main.listBox2.Items.Add(this.textBox1.Text); + } + } + + private void button2_Click(object sender, EventArgs e) + { + this.Close(); + } + } +} diff --git a/Form2.resx b/Form2.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Form2.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..049da7c --- /dev/null +++ b/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApp4 +{ + internal static class Program + { + /// + /// Главная точка входа для приложения. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..e73f65a --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Общие сведения об этой сборке предоставляются следующим набором +// набора атрибутов. Измените значения этих атрибутов для изменения сведений, +// связанных со сборкой. +[assembly: AssemblyTitle("WindowsFormsApp4")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApp4")] +[assembly: AssemblyCopyright("Copyright © 2025")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми +// для компонентов COM. Если необходимо обратиться к типу в этой сборке через +// COM, следует установить атрибут ComVisible в TRUE для этого типа. +[assembly: ComVisible(false)] + +// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM +[assembly: Guid("417f74b1-84ff-45e5-a7e5-87d32986083f")] + +// Сведения о версии сборки состоят из указанных ниже четырех значений: +// +// Основной номер версии +// Дополнительный номер версии +// Номер сборки +// Редакция +// +// Можно задать все значения или принять номера сборки и редакции по умолчанию +// используя "*", как показано ниже: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs new file mode 100644 index 0000000..3550acb --- /dev/null +++ b/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программным средством. +// Версия среды выполнения: 4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если +// код создан повторно. +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApp4.Properties +{ + + + /// + /// Класс ресурсов со строгим типом для поиска локализованных строк и пр. + /// + // Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder + // класс с помощью таких средств, как ResGen или Visual Studio. + // Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen + // с параметром /str или заново постройте свой VS-проект. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Возврат кэшированного экземпляра ResourceManager, используемого этим классом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WindowsFormsApp4.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Переопределяет свойство CurrentUICulture текущего потока для всех + /// подстановки ресурсов с помощью этого класса ресурсов со строгим типом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Properties/Resources.resx b/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs new file mode 100644 index 0000000..51e989d --- /dev/null +++ b/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApp4.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Properties/Settings.settings b/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/WindowsFormsApp4.csproj b/WindowsFormsApp4.csproj new file mode 100644 index 0000000..21c9675 --- /dev/null +++ b/WindowsFormsApp4.csproj @@ -0,0 +1,92 @@ + + + + + Debug + AnyCPU + {417F74B1-84FF-45E5-A7E5-87D32986083F} + WinExe + WindowsFormsApp4 + WindowsFormsApp4 + v4.8 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + Form + + + Form2.cs + + + + + Form1.cs + + + Form2.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/WindowsFormsApp4.sln b/WindowsFormsApp4.sln new file mode 100644 index 0000000..cc6b74d --- /dev/null +++ b/WindowsFormsApp4.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33213.308 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApp4", "WindowsFormsApp4.csproj", "{417F74B1-84FF-45E5-A7E5-87D32986083F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {417F74B1-84FF-45E5-A7E5-87D32986083F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {417F74B1-84FF-45E5-A7E5-87D32986083F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {417F74B1-84FF-45E5-A7E5-87D32986083F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {417F74B1-84FF-45E5-A7E5-87D32986083F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {712169B1-4FA5-45BF-9C37-17D47F43C534} + EndGlobalSection +EndGlobal