diff --git a/TextDocumentEditor/Form1.Designer.cs b/TextDocumentEditor/Form1.Designer.cs index 53a36af..a543174 100644 --- a/TextDocumentEditor/Form1.Designer.cs +++ b/TextDocumentEditor/Form1.Designer.cs @@ -102,39 +102,39 @@ private void InitializeComponent() // newFileToolStripMenuItem // this.newFileToolStripMenuItem.Name = "newFileToolStripMenuItem"; - this.newFileToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.newFileToolStripMenuItem.Size = new System.Drawing.Size(140, 22); this.newFileToolStripMenuItem.Text = "New file..."; this.newFileToolStripMenuItem.Click += new System.EventHandler(this.newFileToolStripMenuItem_Click); // // openFileToolStripMenuItem // this.openFileToolStripMenuItem.Name = "openFileToolStripMenuItem"; - this.openFileToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.openFileToolStripMenuItem.Size = new System.Drawing.Size(140, 22); this.openFileToolStripMenuItem.Text = "Open file..."; this.openFileToolStripMenuItem.Click += new System.EventHandler(this.openFileToolStripMenuItem_Click); // // saveFileToolStripMenuItem // this.saveFileToolStripMenuItem.Name = "saveFileToolStripMenuItem"; - this.saveFileToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.saveFileToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.saveFileToolStripMenuItem.Text = "Save"; // // saveFileAsToolStripMenuItem // this.saveFileAsToolStripMenuItem.Name = "saveFileAsToolStripMenuItem"; - this.saveFileAsToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.saveFileAsToolStripMenuItem.Size = new System.Drawing.Size(140, 22); this.saveFileAsToolStripMenuItem.Text = "Save file as..."; this.saveFileAsToolStripMenuItem.Click += new System.EventHandler(this.saveFileAsToolStripMenuItem_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(137, 6); // // closeApplicationToolStripMenuItem // this.closeApplicationToolStripMenuItem.Name = "closeApplicationToolStripMenuItem"; - this.closeApplicationToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.closeApplicationToolStripMenuItem.Size = new System.Drawing.Size(140, 22); this.closeApplicationToolStripMenuItem.Text = "Close"; // // editToolStripMenuItem @@ -231,6 +231,7 @@ private void InitializeComponent() this.CreateNew.Name = "CreateNew"; this.CreateNew.Size = new System.Drawing.Size(23, 22); this.CreateNew.Text = "Create new..."; + this.CreateNew.Click += new System.EventHandler(this.CreateNew_Click); // // Open // @@ -240,6 +241,7 @@ private void InitializeComponent() this.Open.Name = "Open"; this.Open.Size = new System.Drawing.Size(23, 22); this.Open.Text = "Open"; + this.Open.Click += new System.EventHandler(this.Open_Click); // // Save // diff --git a/TextDocumentEditor/Form1.cs b/TextDocumentEditor/Form1.cs index 673f6ea..c3a13ba 100644 --- a/TextDocumentEditor/Form1.cs +++ b/TextDocumentEditor/Form1.cs @@ -107,5 +107,35 @@ private void openFileToolStripMenuItem_Click(object sender, EventArgs e) } } } + + //Additions + + private void CreateNew_Click(object sender, EventArgs e) + { + childDialogs.Add(new InnerForm(this)); + childDialogs[childDialogs.Count - 1].Show(); + } + + private void Open_Click(object sender, EventArgs e) + { + if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK && + openFileDialog.FileName.Length > 0) + { + childDialogs.Add(new InnerForm(this)); + childDialogs[childDialogs.Count - 1].Show(); + + switch (saveFileDialog.FilterIndex) + { + case 1: + childDialogs[childDialogs.Count - 1].OpenFile(openFileDialog.FileName, RichTextBoxStreamType.PlainText); + break; + + case 2: + childDialogs[childDialogs.Count - 1].OpenFile(openFileDialog.FileName, RichTextBoxStreamType.RichText); + break; + } + } + } + } }