Beispiel #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));
        }
Beispiel #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);
         }
     }
 }
Beispiel #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);
        }
Beispiel #4
0
 private void newToolStripButton_Click(object sender, EventArgs e)
 {
     MultiSDIForm.CreateTopLevelWindow(null);
 }