コード例 #1
0
        private void OpenFile(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            openFileDialog.Filter           = "Basic Script Files (*.bsl)|*.bsl|All Files (*.*)|*.*";
            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                string FileName = openFileDialog.FileName;

                if (ActiveMdiChild != null)
                {
                    MainEditor activeForm = (MainEditor)this.ActiveMdiChild;
                    activeForm.LoadFile(FileName);
                }
                else
                {
                    MainEditor newChild = new MainEditor();
                    newChild.Text      = "Window " + childFormNumber++;
                    newChild.MdiParent = this;
                    newChild.Show();
                    newChild.LoadFile(FileName);
                }
            }
        }
コード例 #2
0
        private void ShowNewForm(object sender, EventArgs e)
        {
            MainEditor childForm = new MainEditor();

            childForm.MdiParent = this;
            childForm.Text      = "Window " + childFormNumber++;
            childForm.Show();
        }