Материал: Объектная реализация полиморфного контейнера на основе линейного списка

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам

}. addUserAfter (userN, userBefore);= userN;

}. Close ();

}(IOException err)

{. Show (err. Message);

}

}

#endregion

#region Чтение из файла 2.void readFromFile (string fName)

{

{inputFile = File. OpenText (fName);read = null, userParams, Name, Password, Rights;userN = null, userBefore = null;( (read = inputFile. ReadLine ())! = null)

{= Decrypt (read, "Passpord11", "Password22", "SHA1", 2,"16CHARSLONG12345", 256);[] split = read. Split (new Char [] { ' ', ',', '. ', ': ', '; ' });= split [0]. Trim ();= split [1]. Trim ();= split [2]. Trim ();(userParams)

{"Гость":= new guest (Name, Rights);;"Пользователь":= split [3]. Trim ();= new defUser (Name, Rights, Password);;"Администратор":= split [3]. Trim ();= new admin (Name, Rights, Password);;

}. addUserAfter (userN, userBefore);= userN;

}. Close ();

}(IOException err)

{. Show (err. Message);

}

}

#endregion

#region Метод showvoid show (DataGridView table)

{(this. head. Next! = null)

{tmp = this. head. Next;(tmp! = null)

{(tmp. Info is admin). Rows. Add ("Администратор", tmp. Info. Name, (tmp. Info as admin). Password, tmp. Info. Rights);if (tmp. Info is guest). Rows. Add ("Гость",tmp. Info. Name, "", tmp. Info. Rights);if (tmp. Info is defUser). Rows. Add ("Пользователь", tmp. Info. Name, (tmp. Info as defUser). Password, tmp. Info. Rights);= tmp. Next;

}

}

}

#endregion

#region Поиск пользователяuser search (string sName)

{(this. head. Next! = null)

{tmp = this. head. Next;(tmp! = null)

{(tmp. Info. Name == sName)tmp. Info;= tmp. Next;

}

}null;

}

#region Static Functions

// / <summary>

// / Encrypts a string

// / </summary>

// / <param name="plainText">Text to be encrypted</param>

// / <param name="password">Password to encrypt with</param>

// / <param name="salt">Salt to encrypt with</param>

// / <param name="hashAlgorithm">Can be either SHA1 or MD5</param>

// / <param name="passwordIterations">Number of iterations to do</param>

// / <param name="initialVector">Needs to be 16 ASCII characters long</param>

// / <param name="keySize">Can be 128, 192, or 256</param>

// / <returns>An encrypted string</returns>string Encrypt (string plainText, string password,salt = "Kosher", string hashAlgorithm = "SHA1",passwordIterations = 2, string initialVector = "OFRna73m*aze01xY",keySize = 256)

{(string. IsNullOrEmpty (plainText))"";[] initialVectorBytes = Encoding. ASCII. GetBytes (initialVector);[] saltValueBytes = Encoding. ASCII. GetBytes (salt);[] plainTextBytes = Encoding. UTF8. GetBytes (plainText);derivedPassword = new PasswordDeriveBytes (password, saltValueBytes, hashAlgorithm, passwordIterations);[] keyBytes = derivedPassword. GetBytes (keySize / 8);symmetricKey = new RijndaelManaged ();. Mode = CipherMode. CBC;[] cipherTextBytes = null;(ICryptoTransform encryptor = symmetricKey. CreateEncryptor (keyBytes, initialVectorBytes))

{(MemoryStream memStream = new MemoryStream ())

{(CryptoStream cryptoStream = new CryptoStream (memStream, encryptor, CryptoStreamMode. Write))

{. Write (plainTextBytes, 0, plainTextBytes. Length);. FlushFinalBlock ();= memStream. ToArray ();. Close ();. Close ();

}

}

}. Clear ();Convert. ToBase64String (cipherTextBytes);

}

// / <summary>

// / Decrypts a string

// / </summary>

// / <param name="cipherText">Text to be decrypted</param>

// / <param name="password">Password to decrypt with</param>

// / <param name="salt">Salt to decrypt with</param>

// / <param name="hashAlgorithm">Can be either SHA1 or MD5</param>

// / <param name="passwordIterations">Number of iterations to do</param>

// / <param name="initialVector">Needs to be 16 ASCII characters long</param>

// / <param name="keySize">Can be 128, 192, or 256</param>

// / <returns>A decrypted string</returns>string Decrypt (string cipherText, string password,salt = "Kosher", string hashAlgorithm = "SHA1",passwordIterations = 2, string initialVector = "OFRna73m*aze01xY",keySize = 256)

{(string. IsNullOrEmpty (cipherText))"";[] initialVectorBytes = Encoding. ASCII. GetBytes (initialVector);[] saltValueBytes = Encoding. ASCII. GetBytes (salt);[] cipherTextBytes = Convert. FromBase64String (cipherText);derivedPassword = new PasswordDeriveBytes (password, saltValueBytes, hashAlgorithm, passwordIterations);[] keyBytes = derivedPassword. GetBytes (keySize / 8);symmetricKey = new RijndaelManaged ();. Mode = CipherMode. CBC;[] plainTextBytes = new byte [cipherTextBytes. Length];byteCount = 0;(ICryptoTransform decryptor = symmetricKey. CreateDecryptor (keyBytes, initialVectorBytes))

{(MemoryStream memStream = new MemoryStream (cipherTextBytes))

{(CryptoStream cryptoStream = new CryptoStream (memStream, decryptor, CryptoStreamMode. Read))

{= cryptoStream. Read (plainTextBytes, 0, plainTextBytes. Length);. Close ();. Close ();

}

}

}. Clear ();Encoding. UTF8. GetString (plainTextBytes, 0, byteCount);

}

#endregion

}

}

Form1. csSystem;System. Collections. Generic;System.componentModel;System. Data;System. Drawing;System. Linq;System. Text;System. Windows. Forms;HotKeysLibrary;курсовая_2курс

{partial class Form1: Form

{Container container;int RowIndex = 0, ColumnIndex;bool after, click, file = false, changed = false;manager = new HotKeysManager ();

#region Конструктор Form1Form1 ()

{();();();. container = new Container ();. container. show (this. dataGridView1);

}

#endregion

#region Инициализация диалога открытия файла

public void OpenFileDialogInit ()

{. openFileDialog = new OpenFileDialog ();. openFileDialog. Filter = "All files (*. d3g) | *. d3g";. openFileDialog. Multiselect = false;. openFileDialog. Title = "Выберите файл";

}

#endregion

#region Инициализация диалога сохранения файла

public void SaveFileDialogInit ()

{. saveFileDialog = new SaveFileDialog ();. saveFileDialog. Filter = "All files (*. d3g) | *. d3g";. saveFileDialog. Title = "Сохранение";

}

#endregion

#region Меню - Создатьvoid onMenuClick_Create (object sender, EventArgs e)

{UserForm = new userForm ();. ShowInTaskbar = false;. StartPosition = FormStartPosition. CenterScreen;. ShowDialog (this);= true;

}

#endregion

#region Меню - Открытьvoid onMenuClick_Open (object sender, EventArgs e)

{(this. openFileDialog. ShowDialog () == DialogResult. OK)

{. container. readFromFile (this. openFileDialog. FileName);. container. show (this. dataGridView1);. file = true;. changed = false;. closeToolStripMenuItem. Enabled = true;. saveAsToolStripMenuItem. Enabled = true;

}

}

#endregion

#region Меню - Сохранитьvoid onMenuSaveButton_Click (object sender, EventArgs e)

{. Save ();

}void Save ()

{. container. saveToFile (this. openFileDialog. FileName);. saveToolStripMenuItem. Enabled = false;. closeToolStripMenuItem. Enabled = true;. changed = false;

}

#endregion

#region Меню - Сохранить какvoid onMenuSaveAsButton_Click (object sender, EventArgs e)

{. SaveAs ();

}void SaveAs ()

{(this. saveFileDialog. ShowDialog () == DialogResult. OK)

{. container. saveToFile (this. saveFileDialog. FileName);. saveToolStripMenuItem. Enabled = false;. closeToolStripMenuItem. Enabled = true;. file = true;. changed = false;

}

}

#endregion

#region Меню - Закрытьvoid onMenuClick_Close (object sender, EventArgs e)

{(this. changed)

{dialogResult = MessageBox. Show ("Данные файла были изменены. \nСохранить изменения в файле?", "Изменения", MessageBoxButtons. YesNoCancel, MessageBoxIcon. Information);(dialogResult! = DialogResult. Cancel)

{(dialogResult == DialogResult. Yes). container. saveToFile (this. openFileDialog. FileName);. clearTable ();

}

}. clearTable ();

}

#endregion

#region Меню - Выходvoid onMenuExitButton_Click (object sender, EventArgs e)

{. Close ();

}

#endregion

#region Очистка полей таблицыvoid clearTable ()

{(dataGridView1. Rows. Count! = 0). Rows. Remove (dataGridView1. Rows [dataGridView1. Rows. Count - 1]);. file = false;. changed = false;. openFileDialog. FileName = null;. closeToolStripMenuItem. Enabled = false;. saveToolStripMenuItem. Enabled = false;. saveAsToolStripMenuItem. Enabled = false;

}

#endregion

#region Создание пользователя. Обработка параметров из userForm

public void onUserCreate (string userType, string userName, string userRights, string userPassword)

{newUser = null;(userType)

{"Гость":= new guest (userName, userRights);;"Пользователь":= new defUser (userName, userRights, userPassword);;"Администратор":= new admin (userName, userRights, userPassword);;

}(! this. click)

{(this. after)

{. dataGridView1. Rows. Insert (this. RowIndex + 1, userType, userName, userPassword, userRights);tmpUser = this. container. search (dataGridView1 [this. ColumnIndex, this. RowIndex]. Value. ToString ());. container. addUserAfter (newUser, tmpUser);

}

{. dataGridView1. Rows. Insert (this. RowIndex, userType, userName, userPassword, userRights);tmpUser = this. container. search (dataGridView1 [this. ColumnIndex, this. RowIndex]. Value. ToString ());. container. addUserBefore (newUser, tmpUser);

}

}

{. dataGridView1. Rows. Add (userType, userName, userPassword, userRights);. container. addUserAfter (newUser, null);

}(this. file)

{. changed = true;. saveToolStripMenuItem. Enabled = true;

}. saveAsToolStripMenuItem. Enabled = true;

}

#endregion

#region Клик "добавить до"

private void addBefore_Click (object sender, EventArgs e)

{. after = false;. click = false;UserForm = new userForm ();. ShowInTaskbar = false;. StartPosition = FormStartPosition. CenterScreen;. ShowDialog (this);

}

#endregion

#region Клик "добавить после"

private void addAfter_Click (object sender, EventArgs e)

{. after = true;. click = false;UserForm = new userForm ();. ShowInTaskbar = false;. StartPosition = FormStartPosition. CenterScreen;. ShowDialog (this);

}

#endregion

#region Клик "удалить пользователя"

private void delete_Click (object sender, EventArgs e)

{dialogResult = MessageBox. Show ("Вы уверены, что хотите удалить пользователя?", "Удаление", MessageBoxButtons. OKCancel, MessageBoxIcon. Question);(dialogResult == DialogResult. OK)

{tmpUser = this. container. search (dataGridView1 [this. ColumnIndex, this. RowIndex]. Value. ToString ());(this. container. deleteUser (tmpUser))

{. dataGridView1. Rows. RemoveAt (this. RowIndex);(this. file)

{. changed = true;. saveToolStripMenuItem. Enabled = true;

}

}

}

}

#endregion

#region Обработка клика правой мышкой по ячейке таблицыvoid context_Opening (object sender, CancelEventArgs e)

{tContextMenu = (ContextMenuStrip) sender;tLocation = new Point (tContextMenu. Left, tContextMenu. Top);= dataGridView1. PointToClient (Cursor. Position);. HitTestInfo tHitTestInfo = dataGridView1. HitTest (tLocation. X, tLocation. Y);(tHitTestInfo. Type == DataGridViewHitTestType. Cell)

{. ColumnIndex = 1;. RowIndex = tHitTestInfo. RowIndex;[tHitTestInfo. ColumnIndex, this. RowIndex]. Selected = true;

}

{. Cancel = true;

}

}

#endregion

#region Закрытие формыvoid FormClosing_Form1 (object sender, FormClosingEventArgs e)

{

#region Если был открыт файл и изменены данные

if (this. file && this. changed)

{dialogResult = MessageBox. Show ("Сохранить данные?", "Изменения", MessageBoxButtons. YesNoCancel, MessageBoxIcon. Information);(dialogResult == DialogResult. Yes)

{. container. saveToFile (this. openFileDialog. FileName);

}if (dialogResult == DialogResult. Cancel)

e. Cancel = true;

}

#endregion

#region Если файл не был открыт и внесены какие-то данные

else if (dataGridView1. Rows. Count! = 0 &&! this. file)

{dialogResult = MessageBox. Show ("Сохранить данные?", "Изменения", MessageBoxButtons. YesNoCancel, MessageBoxIcon. Information);(dialogResult == DialogResult. Yes)

{dialogResultSave = this. saveFileDialog. ShowDialog ();(dialogResultSave == DialogResult. OK)

{. container. saveToFile (this. saveFileDialog. FileName);. clearTable ();

}if (dialogResultSave == DialogResult. Cancel). Cancel = true;

}if (dialogResult == DialogResult. Cancel). Cancel = true;

}

#endregion

}

#endregion

#region Справкаvoid Help_Click (object sender, EventArgs e)

{. Show ("Данное программное обеспечение является частью курсовой работы. \nОно может быть использовано только в ознакомительных и учебных целях! \n\nВыполнил работу студент группы 4212 - Гарифуллин Ильшат. \nПринял доцент к. т. н.: Козин А.Н. \nKazan © 2013 год", "Справка", MessageBoxButtons. OK, MessageBoxIcon. Information);

}

#endregion

}

}

userForm. cs

using System;System. Collections. Generic;System.componentModel;System. Data;System. Drawing;System. Linq;System. Text;System. Windows. Forms;курсовая_2курс

{partial class userForm: Form

{userForm ()

{();

}void onCreateButton_Click (object sender, EventArgs e)

{

( (Form1) this. Owner). onUserCreate (this. userTypeComboBox. Text, this. userNameTextBox. Text, this. userRightsComboBox. Text, this. userPasswordTextBox. Text);. Close ();

}void userType_SelectedIndexChanged (object sender, EventArgs e)

{(this. userTypeComboBox. Text == "Пользователь" || this. userTypeComboBox. Text == "Администратор")

{. userPasswordLabel. Visible = true;. userPasswordTextBox. Visible = true;

}

{. userPasswordLabel. Visible = false;. userPasswordTextBox. Visible = false;

}. checkButton ();

}void userRights_SelectedIndexChanged (object sender, EventArgs e)

{. checkButton ();

}void userName_TextChanged (object sender, EventArgs e)

{. checkButton ();

}void onKeyPress_passwordField (object sender, KeyPressEventArgs e)

{. checkButton ();

}void checkButton ()

{(this. userRightsComboBox. Text. Length! = 0 && this. userNameTextBox. Text. Length! = 0)

{. userButton. Visible = false;( (this. userTypeComboBox. Text == "Пользователь" || this. userTypeComboBox. Text == "Администратор") && this. userPasswordTextBox. Text. Length! = 0). userButton. Visible = true;(this. userTypeComboBox. Text == "Гость"). userButton. Visible = true;

}. userButton. Visible = false;

}void onKeyPress_ComboBox (object sender, KeyPressEventArgs e)

{(e. KeyChar == '\b');. Handled = true;

}void userType_TextUpdate (object sender, EventArgs e)

{(this. userTypeComboBox. Text)

{"Гость":

case "Пользователь":"Администратор":;

default:. userTypeComboBox. Text = "";;

}. checkButton ();

}void userRights_TextUpdate (object sender, EventArgs e)

{(this. userRightsComboBox. Text)

{"Чтение":

case "Чтение/Запись":"Чтение/Запись/Редактирование":

break;:. userRightsComboBox. Text = "";;

}. checkButton ();

}

}

}

Form1. Designer. csкурсовая_2курс

{class Form1

{

// / <summary>

// / Требуется переменная конструктора.

// / </summary>

private System.componentModel. IContainer components = null;

// / <summary>

// / Освободить все используемые ресурсы.

// / </summary>

// / <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно. </param>

protected override void Dispose (bool disposing)

{(disposing && (components! = null))

{. Dispose ();

}. Dispose (disposing);

}

#region Код, автоматически созданный конструктором форм Windows

// / <summary>

// / Обязательный метод для поддержки конструктора - не изменяйте

// / содержимое данного метода при помощи редактора кода.

// / </summary>void InitializeComponent ()

{.components = new System.componentModel. Container ();. menuStrip1 = new System. Windows. Forms. MenuStrip ();. файлToolStripMenuItem = new System. Windows. Forms. ToolStripMenuItem ();. createToolStripMenuItem = new System. Windows. Forms. ToolStripMenuItem ();. openToolStripMenuItem = new System. Windows. Forms. ToolStripMenuItem ();. saveToolStripMenuItem = new System. Windows. Forms. ToolStripMenuItem ();. saveAsToolStripMenuItem = new System. Windows. Forms. ToolStripMenuItem ();. closeToolStripMenuItem = new System. Windows. Forms. ToolStripMenuItem ();. exitToolStripMenuItem = new System. Windows. Forms. ToolStripMenuItem ();. справкаToolStripMenuItem = new System. Windows. Forms. ToolStripMenuItem ();. dataGridView1 = new System. Windows. Forms. DataGridView ();. contextMenuStrip = new System. Windows. Forms. ContextMenuStrip (this.components);. добавитьДоToolStripMenuItem = new System. Windows. Forms. ToolStripMenuItem ();. добавитьПослеToolStripMenuItem = new System. Windows. Forms. ToolStripMenuItem ();. удалитьToolStripMenuItem = new System. Windows. Forms. ToolStripMenuItem ();. openFileDialog = new System. Windows. Forms. OpenFileDialog ();. saveFileDialog = new System. Windows. Forms. SaveFileDialog ();. userType = new System. Windows. Forms. DataGridViewTextBoxColumn ();. ColumnName = new System. Windows. Forms. DataGridViewTextBoxColumn ();. ColumnPassword = new System. Windows. Forms. DataGridViewTextBoxColumn ();. ColumnRights = new System. Windows. Forms. DataGridViewTextBoxColumn ();. menuStrip1. SuspendLayout ();

( (System.componentModel. ISupportInitialize) (this. dataGridView1)). BeginInit ();. contextMenuStrip. SuspendLayout ();. SuspendLayout ();

//

// menuStrip1

// . menuStrip1. Items. AddRange (new System. Windows. Forms. ToolStripItem [] {. файлToolStripMenuItem,. справкаToolStripMenuItem});. menuStrip1. Location = new System. Drawing. Point (0, 0);. menuStrip1. Name = "menuStrip1";. menuStrip1. Size = new System. Drawing. Size (651, 24);. menuStrip1. TabIndex = 0;. menuStrip1. Text = "menuStrip1";

//

// файлToolStripMenuItem

// . файлToolStripMenuItem. DropDownItems. AddRange (new System. Windows. Forms. ToolStripItem [] {. createToolStripMenuItem,. openToolStripMenuItem,. saveToolStripMenuItem,. saveAsToolStripMenuItem,. closeToolStripMenuItem,. exitToolStripMenuItem});. файлToolStripMenuItem. Name = "файлToolStripMenuItem";. файлToolStripMenuItem. Size = new System. Drawing. Size (48, 20);. файлToolStripMenuItem. Text = "Файл";

//

// createToolStripMenuItem

// . createToolStripMenuItem. Name = "createToolStripMenuItem";. createToolStripMenuItem. Size = new System. Drawing. Size (162, 22);. createToolStripMenuItem. Text = "Создать";. createToolStripMenuItem. Click += new System. EventHandler (this. onMenuClick_Create);

//

// openToolStripMenuItem

// . openToolStripMenuItem. Name = "openToolStripMenuItem";. openToolStripMenuItem. Size = new System. Drawing. Size (162, 22);. openToolStripMenuItem. Text = "Открыть. ";. openToolStripMenuItem. Click += new System. EventHandler (this. onMenuClick_Open);

//

// saveToolStripMenuItem

// . saveToolStripMenuItem. Enabled = false;. saveToolStripMenuItem. Name = "saveToolStripMenuItem";. saveToolStripMenuItem. Size = new System. Drawing. Size (162, 22);. saveToolStripMenuItem. Text = "Сохранить. ";. saveToolStripMenuItem. Click += new System. EventHandler (this. onMenuSaveButton_Click);

//

// saveAsToolStripMenuItem

// . saveAsToolStripMenuItem. Enabled = false;. saveAsToolStripMenuItem. Name = "saveAsToolStripMenuItem";. saveAsToolStripMenuItem. Size = new System. Drawing. Size (162, 22);. saveAsToolStripMenuItem. Text = "Сохранить как. ";. saveAsToolStripMenuItem. Click += new System. EventHandler (this. onMenuSaveAsButton_Click);

//

// closeToolStripMenuItem

// . closeToolStripMenuItem. Enabled = false;. closeToolStripMenuItem. Name = "closeToolStripMenuItem";. closeToolStripMenuItem. Size = new System. Drawing. Size (162, 22);. closeToolStripMenuItem. Text = "Закрыть";. closeToolStripMenuItem. Click += new System. EventHandler (this. onMenuClick_Close);

//

// exitToolStripMenuItem

// . exitToolStripMenuItem. Name = "exitToolStripMenuItem";. exitToolStripMenuItem. Size = new System. Drawing. Size (162, 22);. exitToolStripMenuItem. Text = "Выход";. exitToolStripMenuItem. Click += new System. EventHandler (this. onMenuExitButton_Click);

//

// справкаToolStripMenuItem

// . справкаToolStripMenuItem. Name = "справкаToolStripMenuItem";. справкаToolStripMenuItem. Size = new System. Drawing. Size (65, 20);. справкаToolStripMenuItem. Text = "Справка";. справкаToolStripMenuItem. Click += new System. EventHandler (this. Help_Click);

//

// dataGridView1

// . dataGridView1. AllowUserToAddRows = false;. dataGridView1. AllowUserToDeleteRows = false;. dataGridView1. AllowUserToResizeRows = false;. dataGridView1. Anchor = ( (System. Windows. Forms. AnchorStyles) ( ( ( (System. Windows. Forms. AnchorStyles. Top | System. Windows. Forms. AnchorStyles. Bottom)

| System. Windows. Forms. AnchorStyles. Left)

| System. Windows. Forms. AnchorStyles. Right)));. dataGridView1. AutoSizeColumnsMode = System. Windows. Forms. DataGridViewAutoSizeColumnsMode. Fill;. dataGridView1. BackgroundColor = System. Drawing. SystemColors. Control;. dataGridView1. CellBorderStyle = System. Windows. Forms. DataGridViewCellBorderStyle. Raised;. dataGridView1. ColumnHeadersHeightSizeMode = System. Windows. Forms. DataGridViewColumnHeadersHeightSizeMode. AutoSize;. dataGridView1. Columns. AddRange (new System. Windows. Forms. DataGridViewColumn [] {. userType,. ColumnName,. ColumnPassword,. ColumnRights});. dataGridView1. EditMode = System. Windows. Forms. DataGridViewEditMode. EditProgrammatically;. dataGridView1. EnableHeadersVisualStyles = false;. dataGridView1. GridColor = System. Drawing. SystemColors. ActiveCaptionText;. dataGridView1. Location = new System. Drawing. Point (0, 27);. dataGridView1. MinimumSize = new System. Drawing. Size (534, 298);. dataGridView1. MultiSelect = false;. dataGridView1. Name = "dataGridView1";. dataGridView1. ReadOnly = true;. dataGridView1. RowHeadersWidth = 30;. dataGridView1. RowTemplate. ContextMenuStrip = this. contextMenuStrip;. dataGridView1. RowTemplate. ReadOnly = true;. dataGridView1. ShowEditingIcon = false;. dataGridView1. Size = new System. Drawing. Size (651, 305);. dataGridView1. TabIndex = 1;

//

// contextMenuStrip

// . contextMenuStrip. Items. AddRange (new System. Windows. Forms. ToolStripItem [] {. добавитьДоToolStripMenuItem,. добавитьПослеToolStripMenuItem,. удалитьToolStripMenuItem});. contextMenuStrip. Name = "contextMenuStrip";. contextMenuStrip. Size = new System. Drawing. Size (172, 70);. contextMenuStrip. Opening += new System.componentModel. CancelEventHandler (this. context_Opening);

//

// добавитьДоToolStripMenuItem

// . добавитьДоToolStripMenuItem. Name = "добавитьДоToolStripMenuItem";. добавитьДоToolStripMenuItem. Size = new System. Drawing. Size (171, 22);. добавитьДоToolStripMenuItem. Text = "Добавить до. ";. добавитьДоToolStripMenuItem. TextAlign = System. Drawing. ContentAlignment. BottomLeft;. добавитьДоToolStripMenuItem. Click += new System. EventHandler (this. addBefore_Click);

//

// добавитьПослеToolStripMenuItem

// . добавитьПослеToolStripMenuItem. Name = "добавитьПослеToolStripMenuItem";. добавитьПослеToolStripMenuItem. Size = new System. Drawing. Size (171, 22);. добавитьПослеToolStripMenuItem. Text = "Добавить после. ";. добавитьПослеToolStripMenuItem. TextAlign = System. Drawing. ContentAlignment. BottomLeft;. добавитьПослеToolStripMenuItem. Click += new System. EventHandler (this. addAfter_Click);