예제 #1
0
        private void SearchNext_Click(object sender, System.EventArgs e)
        {
            MdiChild thisMdiChild = (ActiveMdiChild as MdiChild);

            findDialog.Direction = FindReplace.FindDirection.Down;
            findDialog.FindString(thisMdiChild.TextInput);
        }
예제 #2
0
        private void ToggleWordWrap(short mode)
        {
            // Cast the active MDI child form as the template,
            // for access to the controls inside it.
            MdiChild thisMdiChild = (ActiveMdiChild as MdiChild);

            // Toggle word wrap in the text box.
            if (ActiveMdiChild != null)
            {
                if (thisMdiChild.TextInput.WordWrap == false)
                {
                    if (mode == 1)
                    {
                        thisMdiChild.TextInput.WordWrap = true;
                        EditWordWrap.Checked            = true;
                    }
                    else if (mode == 0)
                    {
                        EditWordWrap.Checked = false;
                    }
                }
                else
                {
                    if (mode == 1)
                    {
                        thisMdiChild.TextInput.WordWrap = false;
                        EditWordWrap.Checked            = false;
                    }
                    else if (mode == 0)
                    {
                        EditWordWrap.Checked = true;
                    }
                }
            }
        }
예제 #3
0
        private void EditCut_Click(object sender, EventArgs e)
        {
            MdiChild thisMdiChild = (ActiveMdiChild as MdiChild);

            Clipboard.SetText(thisMdiChild.TextInput.SelectedText);
            thisMdiChild.TextInput.Text =
                thisMdiChild.TextInput.Text.Remove(thisMdiChild.TextInput.SelectionStart, thisMdiChild.TextInput.SelectedText.Length);
        }
예제 #4
0
        private void EditUndo_Click(object sender, System.EventArgs e)
        {
            // Cast the active MDI child form as the template,
            // for access to the controls inside it.
            MdiChild thisMdiChild = (ActiveMdiChild as MdiChild);

            thisMdiChild.TextInput.Undo();
        }
예제 #5
0
        private void FileNew_Click(object sender, System.EventArgs e)
        {
            MdiChild newMdiChild = new MdiChild();

            newMdiChild.Text      = "Untitled";
            newMdiChild.MdiParent = this;
            newMdiChild.Show();
        }
예제 #6
0
        private void findDialog_FindNextClick()
        {
            MdiChild thisMdiChild = (ActiveMdiChild as MdiChild);

            try
            {
                findDialog.FindString(thisMdiChild.TextInput);
            }
            catch
            { }
        }
예제 #7
0
        private void SaveFile(object sender, CancelEventArgs e)
        {
            MdiChild thisMdiChild = (ActiveMdiChild as MdiChild);
            string   safeName     = Path.GetFileName(saveDialog.FileName);

            using (StreamWriter writer = new StreamWriter(saveDialog.FileName))
            {
                writer.Write(thisMdiChild.TextInput.Text);
            }
            thisMdiChild.Text               = safeName;
            thisMdiChild.openedFilePath     = saveDialog.FileName;
            thisMdiChild.TextInput.Modified = false;
        }
예제 #8
0
        private void OpenFile(object sender, CancelEventArgs e)
        {
            MdiChild newMdiChild = new MdiChild();

            newMdiChild.MdiParent = this;
            using (StreamReader reader = new StreamReader(openDialog.FileName))
            {
                newMdiChild.TextInput.Text = reader.ReadToEnd();
            }
            newMdiChild.Text           = openDialog.SafeFileName;
            newMdiChild.openedFilePath = openDialog.FileName;
            newMdiChild.Show();
        }
예제 #9
0
        private void FileSave_Click(object sender, System.EventArgs e)
        {
            MdiChild thisMdiChild = (ActiveMdiChild as MdiChild);

            if (thisMdiChild.openedFilePath != "Untitled")
            {
                string safeName = Path.GetFileName(thisMdiChild.openedFilePath);
                using (StreamWriter writer = new StreamWriter(thisMdiChild.openedFilePath))
                {
                    writer.Write(thisMdiChild.TextInput.Text);
                }
                thisMdiChild.TextInput.Modified = false;
                thisMdiChild.Text = safeName;
            }
            else
            {
                saveDialog.ShowDialog();
            }
        }
예제 #10
0
        private void MainForm_Load(object sender, System.EventArgs e)
        {
            MdiChild newMdiChild = new MdiChild();

            newMdiChild.MdiParent   = this;
            newMdiChild.Text        = "Untitled";
            newMdiChild.WindowState = FormWindowState.Maximized;
            try
            {
                if (Environment.GetCommandLineArgs().GetValue(1).ToString() != string.Empty)
                {
                    newMdiChild.openedFilePath = Environment.GetCommandLineArgs().GetValue(1).ToString();
                    if (File.Exists(newMdiChild.openedFilePath))
                    {
                        newMdiChild.Text           = Path.GetFileName(newMdiChild.openedFilePath);
                        newMdiChild.TextInput.Text = File.ReadAllText(newMdiChild.openedFilePath);
                        newMdiChild.TextInput.DeselectAll();
                    }
                    else
                    {
                        switch (MessageBox.Show("Cannot find the " + newMdiChild.openedFilePath + " file." + (char)10 + "Do you want to create a new file?", "Multipad .NET", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation))
                        {
                        case DialogResult.Yes:
                            File.CreateText(newMdiChild.openedFilePath);
                            newMdiChild.Text           = Path.GetFileName(newMdiChild.openedFilePath);
                            newMdiChild.TextInput.Text = File.ReadAllText(newMdiChild.openedFilePath);
                            return;

                        case DialogResult.No:
                            return;
                        }
                    }
                }
            }
            catch { return; }
            finally { newMdiChild.Show(); }
        }
예제 #11
0
        private void EditCopy_Click(object sender, EventArgs e)
        {
            MdiChild thisMdiChild = (ActiveMdiChild as MdiChild);

            Clipboard.SetText(thisMdiChild.TextInput.SelectedText);
        }
예제 #12
0
        private void EditPaste_Click(object sender, System.EventArgs e)
        {
            MdiChild thisMdiChild = (ActiveMdiChild as MdiChild);

            thisMdiChild.TextInput.Text += Clipboard.GetText();
        }