Esempio n. 1
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.FileName = "Текстовые файлы";
            openFileDialog1.Filter   = "Text Files (*.txt)|*.txt|All Files(*.*)|*.*";

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                file_form ff = new file_form();
                ff.Open(openFileDialog1.FileName);
                ff.MdiParent = this;
                ff.setFormName(openFileDialog1.FileName);
                ff.Text = ff.getFormName();
                ff.Show();
                saveAsToolStripMenuItem.Enabled = true;
                saveToolStripMenuItem.Enabled   = true;
                ToolStripMenuItem tsmi = new ToolStripMenuItem(ff.getFormName(), null, new EventHandler(menuClick));
                arrangeIconsToolStripMenuItem.DropDownItems.Add(tsmi);
            }
        }
Esempio n. 2
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            file_form new_ff = new file_form();

            new_ff.MdiParent = this;
            new_ff.setFormName("Untitled " + window_id);
            new_ff.Show();
            window_id++;

            ToolStripMenuItem tsmi = new ToolStripMenuItem(new_ff.getFormName(), null, new EventHandler(menuClick));

            arrangeIconsToolStripMenuItem.DropDownItems.Add(tsmi);
        }
Esempio n. 3
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            saveFileDialog1.FileName = "Текстовые файлы";
            saveFileDialog1.Filter   = "Text Files (*.txt)|*.txt|All Files(*.*)|*.*";

            file_form ff = (file_form)this.ActiveMdiChild;

            if (ff.Text == ("Untitled " + window_id))
            {
                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    ff.Save(saveFileDialog1.FileName);
                    ff.MdiParent = this;
                    ff.setFormName(saveFileDialog1.FileName);
                    ff.Text = ff.getFormName();
                }
            }
            else
            {
                ff.Save(ff.getFormName());
            }
        }
Esempio n. 4
0
        private void arrangeIconsToolStripMenuItem_DropDownOpening(object sender, EventArgs e)
        {
            foreach (ToolStripMenuItem val in arrangeIconsToolStripMenuItem.DropDownItems)
            {
                val.Checked = false;
            }
            if (this.ActiveMdiChild == null)
            {
                return;
            }

            file_form tmp = this.ActiveMdiChild as file_form;

            foreach (ToolStripMenuItem val in arrangeIconsToolStripMenuItem.DropDownItems)
            {
                if (tmp.getFormName().CompareTo(val.Text) == 0)
                {
                    val.Checked = true;
                    break;
                }
            }
        }