private void replaseAll_Click(object sender, EventArgs e)
 {
     if (replaseFild.Text != "")
     {
         NotepadForm.GetNotepadForm().mainTextBox.Text = NotepadForm.GetNotepadForm().mainTextBox.Text.Replace(serchingFild.Text, replaseFild.Text);
     }
 }
        private void nextBtn_Click(object sender, EventArgs e)
        {
            var com = StringComparison.Ordinal;

            if (!tolower.Checked)
            {
                com = StringComparison.OrdinalIgnoreCase;
            }

            if (NotepadForm.GetNotepadForm().mainTextBox.SelectionStart == 0 && NotepadForm.GetNotepadForm().mainTextBox.Text.Substring(0, serchingFild.TextLength) == serchingFild.Text)
            {
                NotepadForm.GetNotepadForm().mainTextBox.Select(0, serchingFild.TextLength);
                NotepadForm.GetNotepadForm().mainTextBox.Focus();
            }
            else
            {
                if (NotepadForm.GetNotepadForm().mainTextBox.SelectionStart + 1 <= NotepadForm.GetNotepadForm().mainTextBox.TextLength&& NotepadForm.GetNotepadForm().mainTextBox.Text.IndexOf(serchingFild.Text, NotepadForm.GetNotepadForm().mainTextBox.SelectionStart + 1, com) != -1)
                {
                    NotepadForm.GetNotepadForm().mainTextBox.Select(NotepadForm.GetNotepadForm().mainTextBox.Text.IndexOf(serchingFild.Text, NotepadForm.GetNotepadForm().mainTextBox.SelectionStart + 1, com), serchingFild.TextLength);
                    NotepadForm.GetNotepadForm().mainTextBox.Focus();
                }
                else
                {
                    MessageBox.Show("Совпадений не найдено!");
                }
            }
        }
Exemple #3
0
        internal void CreateNewForm(string path)
        {
            if (!File.Exists(path))
            {
                return;
            }
            foreach (NotepadForm child in MdiChildren)
            {
                if (child.FileName == path)
                {
                    child.Activate();
                    return;
                }
            }
            nom++;
            var form = new NotepadForm(path)
            {
                MdiParent = this, Text = Path.GetFileName(path)
            };

            if (wind.Checked)
            {
                form.WindowState = FormWindowState.Maximized;
            }
            form.Show();
        }
Exemple #4
0
 public NotepadForm()
 {
     InitializeComponent();
     mainTextBox.Size = new Size(mainTextBox.Size.Width, mainTextBox.Size.Height + statusStrip.Size.Height);
     cut.Enabled      = false;
     copy.Enabled     = false;
     delete.Enabled   = false;
     find.Enabled     = false;
     findNext.Enabled = false;
     np = this;
     replaseForm.TopMost = true;
     searchForm.TopMost  = true;
 }
Exemple #5
0
        private void butGo_Click(object sender, EventArgs e) // Кнопка "Перейти к строке"
        {
            NotepadForm main = this.Owner as NotepadForm;

            if (main != null)
            {
                int lineNumber = Convert.ToInt32(tbLineNum.Text);
                if (lineNumber > 0 && lineNumber <= main.maintextBox.Lines.Count())
                {
                    main.maintextBox.SelectionStart = main.maintextBox.GetFirstCharIndexFromLine(Convert.ToInt32(tbLineNum.Text) - 1);
                    main.maintextBox.ScrollToCaret();
                    this.Close();
                }
            }
        }
Exemple #6
0
        internal void CreateNewForm()
        {
            nom++;
            var form = new NotepadForm {
                MdiParent = this, Text = "Notepad" + nom
            };

            form.DragEnter             += this.MDINotepad_DragEnter;
            form.DragDrop              += this.MDINotepad_DragDrop;
            form.mainTextBox.DragEnter += this.MDINotepad_DragEnter;
            form.mainTextBox.DragDrop  += this.MDINotepad_DragDrop;
            form.DocumentChanged       += DocumentChanged;
            form.DocumentChanged       += (s, e) => UpdateTools();
            if (wind.Checked)
            {
                form.WindowState = FormWindowState.Maximized;
            }
            form.Show();
        }
 private void replase_Click(object sender, EventArgs e)
 {
     if (replaseFild.Text != "")
     {
         var com = StringComparison.Ordinal;
         if (!tolower.Checked)
         {
             com = StringComparison.OrdinalIgnoreCase;
         }
         if (NotepadForm.GetNotepadForm().mainTextBox.Text.IndexOf(serchingFild.Text, NotepadForm.GetNotepadForm().mainTextBox.SelectionStart, com) != -1)
         {
             int start = NotepadForm.GetNotepadForm().mainTextBox.Text.IndexOf(serchingFild.Text, NotepadForm.GetNotepadForm().mainTextBox.SelectionStart, com);
             NotepadForm.GetNotepadForm().mainTextBox.Text = Replace(NotepadForm.GetNotepadForm().mainTextBox.Text, start, serchingFild.Text, replaseFild.Text);
             NotepadForm.GetNotepadForm().mainTextBox.SelectionStart = start;
             NotepadForm.GetNotepadForm().mainTextBox.SelectionLength = replaseFild.TextLength;
             NotepadForm.GetNotepadForm().mainTextBox.Focus();
         }
         else
         {
             MessageBox.Show("Совпадений не найдено!");
         }
     }
 }
Exemple #8
0
        private void findNext_Click(object sender, EventArgs e)
        {
            if (searchForm.serchingFild.Text != "")
            {
                if (searchForm.up.Checked)
                {
                    var com = StringComparison.Ordinal;
                    if (!searchForm.tolower.Checked)
                    {
                        com = StringComparison.OrdinalIgnoreCase;
                    }

                    if (NotepadForm.GetNotepadForm().mainTextBox.SelectionStart == 0 && NotepadForm.GetNotepadForm().mainTextBox.Text.Substring(0, searchForm.serchingFild.TextLength) == searchForm.serchingFild.Text)
                    {
                        NotepadForm.GetNotepadForm().mainTextBox.Select(0, searchForm.serchingFild.TextLength);
                        NotepadForm.GetNotepadForm().mainTextBox.Focus();
                    }
                    else
                    {
                        if (NotepadForm.GetNotepadForm().mainTextBox.SelectionStart - 1 > 0 && NotepadForm.GetNotepadForm().mainTextBox.Text.LastIndexOf(searchForm.serchingFild.Text, NotepadForm.GetNotepadForm().mainTextBox.SelectionStart - 1, com) != -1)
                        {
                            NotepadForm.GetNotepadForm().mainTextBox.Select(NotepadForm.GetNotepadForm().mainTextBox.Text.LastIndexOf(searchForm.serchingFild.Text, NotepadForm.GetNotepadForm().mainTextBox.SelectionStart - 1, com), searchForm.serchingFild.TextLength);
                            NotepadForm.GetNotepadForm().mainTextBox.Focus();
                        }
                        else
                        {
                            MessageBox.Show("Совпадений не найдено!");
                        }
                    }
                }
                else if (searchForm.down.Checked)
                {
                    var com = StringComparison.Ordinal;
                    if (!searchForm.tolower.Checked)
                    {
                        com = StringComparison.OrdinalIgnoreCase;
                    }

                    if (NotepadForm.GetNotepadForm().mainTextBox.SelectionStart == 0 && NotepadForm.GetNotepadForm().mainTextBox.Text.Substring(0, searchForm.serchingFild.TextLength) == searchForm.serchingFild.Text)
                    {
                        NotepadForm.GetNotepadForm().mainTextBox.Select(0, searchForm.serchingFild.TextLength);
                        NotepadForm.GetNotepadForm().mainTextBox.Focus();
                    }
                    else
                    {
                        if (NotepadForm.GetNotepadForm().mainTextBox.SelectionStart + 1 <= NotepadForm.GetNotepadForm().mainTextBox.TextLength&& NotepadForm.GetNotepadForm().mainTextBox.Text.IndexOf(searchForm.serchingFild.Text, NotepadForm.GetNotepadForm().mainTextBox.SelectionStart + 1, com) != -1)
                        {
                            NotepadForm.GetNotepadForm().mainTextBox.Select(NotepadForm.GetNotepadForm().mainTextBox.Text.IndexOf(searchForm.serchingFild.Text, NotepadForm.GetNotepadForm().mainTextBox.SelectionStart + 1, com), searchForm.serchingFild.TextLength);
                            NotepadForm.GetNotepadForm().mainTextBox.Focus();
                        }
                        else
                        {
                            MessageBox.Show("Совпадений не найдено!");
                        }
                    }
                }
            }
            else if (replaseForm.serchingFild.Text != "")
            {
                var com = StringComparison.Ordinal;
                if (!replaseForm.tolower.Checked)
                {
                    com = StringComparison.OrdinalIgnoreCase;
                }

                if (NotepadForm.GetNotepadForm().mainTextBox.SelectionStart == 0 && NotepadForm.GetNotepadForm().mainTextBox.Text.Substring(0, searchForm.serchingFild.TextLength) == searchForm.serchingFild.Text)
                {
                    NotepadForm.GetNotepadForm().mainTextBox.Select(0, replaseForm.serchingFild.TextLength);
                    NotepadForm.GetNotepadForm().mainTextBox.Focus();
                }
                else
                {
                    if (NotepadForm.GetNotepadForm().mainTextBox.SelectionStart + 1 <= NotepadForm.GetNotepadForm().mainTextBox.TextLength&& NotepadForm.GetNotepadForm().mainTextBox.Text.IndexOf(searchForm.serchingFild.Text, NotepadForm.GetNotepadForm().mainTextBox.SelectionStart + 1, com) != -1)
                    {
                        NotepadForm.GetNotepadForm().mainTextBox.Select(NotepadForm.GetNotepadForm().mainTextBox.Text.IndexOf(searchForm.serchingFild.Text, NotepadForm.GetNotepadForm().mainTextBox.SelectionStart + 1, com), searchForm.serchingFild.TextLength);
                        NotepadForm.GetNotepadForm().mainTextBox.Focus();
                    }
                    else
                    {
                        MessageBox.Show("Совпадений не найдено!");
                    }
                }
            }
            else
            {
                searchForm.Show();
            }
        }