private void mFileNew_Click(object sender, EventArgs e)
 {
     if (tbChange == true)
     {
         DialogResult message = MessageBox.Show("Сохранить текущий документ перед созданием нового?", "Создание документа", MessageBoxButtons.YesNoCancel);
         if (message == DialogResult.Yes)
         {
             if (docPath != "")
             {
                 FileWork.SaveFile(ref notebox, ref tbChange, ref docPath);
                 FileWork.CreateFile(ref notebox, ref tbChange, ref docPath);
             }
             else if (docPath == "")
             {
                 FileWork.SaveAsFile(ref notebox, ref tbChange, ref docPath);
                 FileWork.CreateFile(ref notebox, ref tbChange, ref docPath);
             }
         }
         else if (message == DialogResult.No)
         {
             FileWork.CreateFile(ref notebox, ref tbChange, ref docPath);
         }
     }
     else
     {
         FileWork.CreateFile(ref notebox, ref tbChange, ref docPath);
     }
 }
        private void Form_Closing(object sender, FormClosingEventArgs e)
        {
            Properties.Settings.Default.formWidth  = this.Width;
            Properties.Settings.Default.formHeight = this.Height;
            Properties.Settings.Default.textFont   = notebox.Font;
            Properties.Settings.Default.Save();

            if (tbChange == true)
            {
                DialogResult message = MessageBox.Show("Сохранить текущий документ перед выходом?", "Выход из программы", MessageBoxButtons.YesNoCancel);
                if (message == DialogResult.Yes)
                {
                    if (docPath != "")
                    {
                        FileWork.SaveFile(ref notebox, ref tbChange, ref docPath);
                        Application.Exit();
                    }
                    else if (docPath == "")
                    {
                        FileWork.SaveAsFile(ref notebox, ref tbChange, ref docPath);
                        Application.Exit();
                    }
                }
                else if (message == DialogResult.Cancel)
                {
                    e.Cancel = true;
                }
            }
        }
 private void toolStripButton2_Click(object sender, EventArgs e)
 {
     if (tbChange == true)
     {
         DialogResult message = MessageBox.Show("Сохранить текущий документ перед открытием нового?", "Открытие документа", MessageBoxButtons.YesNoCancel);
         if (message == DialogResult.Yes)
         {
             if (docPath != "")
             {
                 FileWork.SaveFile(ref notebox, ref tbChange, ref docPath);
                 FileWork.OpenFile(ref notebox, ref tbChange, ref docPath);
             }
             else if (docPath == "")
             {
                 FileWork.SaveAsFile(ref notebox, ref tbChange, ref docPath);
                 FileWork.OpenFile(ref notebox, ref tbChange, ref docPath);
             }
         }
         else if (message == DialogResult.No)
         {
             FileWork.OpenFile(ref notebox, ref tbChange, ref docPath);
         }
         else
         {
             return;
         }
     }
     else
     {
         FileWork.OpenFile(ref notebox, ref tbChange, ref docPath);
     }
 }
 private void toolStripButton3_Click(object sender, EventArgs e)
 {
     if (docPath != "")
     {
         FileWork.SaveFile(ref notebox, ref tbChange, ref docPath);
     }
     else
     {
         FileWork.SaveAsFile(ref notebox, ref tbChange, ref docPath);
     }
 }
 private void mFileSaveAs_Click(object sender, EventArgs e)
 {
     FileWork.SaveAsFile(ref notebox, ref tbChange, ref docPath);
 }