예제 #1
0
        private System.Windows.Forms.Form CreateTopLevelWindow(
            ReadOnlyCollection <string> args)
        {
            String fileName = null;

            if (args.Count > 0)
            {
                fileName = args[0];
            }
            return(MultiSDIForm.CreateTopLevelWindow(fileName));
        }
예제 #2
0
 private void openToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog dlg = new OpenFileDialog())
     {
         dlg.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             MultiSDIForm.CreateTopLevelWindow(dlg.FileName);
         }
     }
 }
예제 #3
0
        //private void InitializeComponent()
        //{
        //    this.SuspendLayout();
        //    //
        //    // MainForm
        //    //
        //    this.ClientSize = new System.Drawing.Size(360, 280);
        //    this.Name = "MainForm";
        //    this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
        //    this.ResumeLayout(false);

        //}

        public static MultiSDIForm CreateTopLevelWindow(String fileName)
        {
            if (!String.IsNullOrEmpty(fileName))
            {
                foreach (MultiSDIForm form in Application.OpenForms)
                {
                    if (String.Compare(form.FileName, fileName, true) == 0)
                    {
                        form.Activate();
                        return(form);
                    }
                }
            }

            MultiSDIForm newForm = new MultiSDIForm();

            newForm.OpenFile(fileName);
            newForm.Show();
            newForm.Activate();
            return(newForm);
        }
예제 #4
0
 private void newToolStripButton_Click(object sender, EventArgs e)
 {
     MultiSDIForm.CreateTopLevelWindow(null);
 }