diff --git a/CNSA-212-Personal-CAS.sln.DotSettings.user b/CNSA-212-Personal-CAS.sln.DotSettings.user new file mode 100644 index 0000000..fa2fe2e --- /dev/null +++ b/CNSA-212-Personal-CAS.sln.DotSettings.user @@ -0,0 +1,2 @@ + + <AssemblyExplorer /> \ No newline at end of file diff --git a/Chapter6/Chapter6.csproj b/Chapter6/Chapter6.csproj index 8780960..203fd7b 100644 --- a/Chapter6/Chapter6.csproj +++ b/Chapter6/Chapter6.csproj @@ -46,6 +46,12 @@ + + Form + + + frmAbout.cs + Form @@ -66,6 +72,9 @@ + + frmAbout.cs + frmCalculate.cs diff --git a/Chapter6/frmAbout.Designer.cs b/Chapter6/frmAbout.Designer.cs new file mode 100644 index 0000000..23d5db0 --- /dev/null +++ b/Chapter6/frmAbout.Designer.cs @@ -0,0 +1,62 @@ +using System.ComponentModel; + +namespace Chapter6 +{ + partial class frmAbout + { + /// + /// Required designer variable. + /// + private IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.btnOK = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // btnOK + // + this.btnOK.Location = new System.Drawing.Point(350, 330); + this.btnOK.Name = "btnOK"; + this.btnOK.Size = new System.Drawing.Size(75, 23); + this.btnOK.TabIndex = 0; + this.btnOK.Text = "OK"; + this.btnOK.UseVisualStyleBackColor = true; + this.btnOK.Click += new System.EventHandler(this.btnOK_Click); + // + // frmAbout + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(437, 365); + this.Controls.Add(this.btnOK); + this.Name = "frmAbout"; + this.Text = "frmAbout"; + this.ResumeLayout(false); + } + + private System.Windows.Forms.Button btnOK; + + #endregion + } +} \ No newline at end of file diff --git a/Chapter6/frmAbout.cs b/Chapter6/frmAbout.cs new file mode 100644 index 0000000..89e7344 --- /dev/null +++ b/Chapter6/frmAbout.cs @@ -0,0 +1,42 @@ +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace Chapter6 +{ + public partial class frmAbout : Form + { + public frmAbout() + { + InitializeComponent(); + + + Text = "About"; + StartPosition = FormStartPosition.CenterParent; + Size = new Size(400, 300); + + var aboutLabel = new Label + { + Text = "MDI Application\nVersion Alpha 0.0.1\n©2024 EggTech\nAll rights reserved.", + TextAlign = ContentAlignment.MiddleCenter, + Dock = DockStyle.Fill + }; + + var closeButton = new Button + { + Text = "Close", + Dock = DockStyle.Bottom + }; + closeButton.Click += (sender, e) => { Close(); }; + + Controls.Add(aboutLabel); + Controls.Add(closeButton); + } + + + private void btnOK_Click(object sender, EventArgs e) + { + Close(); + } + } +} \ No newline at end of file diff --git a/Chapter6/frmAbout.resx b/Chapter6/frmAbout.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Chapter6/frmAbout.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Chapter6/frmMain.Designer.cs b/Chapter6/frmMain.Designer.cs index 6445ff1..7cc8d7e 100644 --- a/Chapter6/frmMain.Designer.cs +++ b/Chapter6/frmMain.Designer.cs @@ -123,31 +123,34 @@ namespace Chapter6 // mnuWindowArrangeIcons // this.mnuWindowArrangeIcons.Name = "mnuWindowArrangeIcons"; - this.mnuWindowArrangeIcons.Size = new System.Drawing.Size(147, 22); + this.mnuWindowArrangeIcons.Size = new System.Drawing.Size(152, 22); this.mnuWindowArrangeIcons.Text = "Arrange Icons"; // // mnuWindowsCascade // this.mnuWindowsCascade.Name = "mnuWindowsCascade"; - this.mnuWindowsCascade.Size = new System.Drawing.Size(147, 22); + this.mnuWindowsCascade.Size = new System.Drawing.Size(152, 22); this.mnuWindowsCascade.Text = "Cascade"; + this.mnuWindowsCascade.Click += new System.EventHandler(this.mnuWindowsCascade_Click); // // munWindowHorizontal // this.munWindowHorizontal.Name = "munWindowHorizontal"; - this.munWindowHorizontal.Size = new System.Drawing.Size(147, 22); + this.munWindowHorizontal.Size = new System.Drawing.Size(152, 22); this.munWindowHorizontal.Text = "Horizontal"; + this.munWindowHorizontal.Click += new System.EventHandler(this.munWindowHorizontal_Click); // // mnuWindowVertical // this.mnuWindowVertical.Name = "mnuWindowVertical"; - this.mnuWindowVertical.Size = new System.Drawing.Size(147, 22); + this.mnuWindowVertical.Size = new System.Drawing.Size(152, 22); this.mnuWindowVertical.Text = "Vertical"; + this.mnuWindowVertical.Click += new System.EventHandler(this.mnuWindowVertical_Click); // // mnuWindowCloseAll // this.mnuWindowCloseAll.Name = "mnuWindowCloseAll"; - this.mnuWindowCloseAll.Size = new System.Drawing.Size(147, 22); + this.mnuWindowCloseAll.Size = new System.Drawing.Size(152, 22); this.mnuWindowCloseAll.Text = "Close All"; // // mnuHelp @@ -162,6 +165,7 @@ namespace Chapter6 this.mnuHelpAbout.Name = "mnuHelpAbout"; this.mnuHelpAbout.Size = new System.Drawing.Size(107, 22); this.mnuHelpAbout.Text = "About"; + this.mnuHelpAbout.Click += new System.EventHandler(this.mnuHelpAbout_Click); // // frmMain // diff --git a/Chapter6/frmMain.cs b/Chapter6/frmMain.cs index c0ded0c..babe473 100644 --- a/Chapter6/frmMain.cs +++ b/Chapter6/frmMain.cs @@ -44,7 +44,7 @@ namespace Chapter6 frmSummary aform = new frmSummary(); mnuFile.Visible = true; - mnuEditSummary.Enabled = true; + aform.MdiParent = this; @@ -52,8 +52,41 @@ namespace Chapter6 aform.Show(); aform.Focus(); - mnuEditCalculate.Checked = true; + mnuEditSummary.Checked = true; } + + private void mnuHelpAbout_Click(object sender, EventArgs e) + { + frmAbout aform = new frmAbout(); + + mnuFile.Visible = true; + + + + aform.MdiParent = this; + aform.StartPosition = FormStartPosition.CenterParent; + aform.Show(); + aform.Focus(); + + mnuHelpAbout.Checked = true; + } + + private void mnuWindowVertical_Click(object sender, EventArgs e) + { + + this.LayoutMdi(MdiLayout.TileVertical); + + } + + private void munWindowHorizontal_Click(object sender, EventArgs e) + { + LayoutMdi(MdiLayout.TileHorizontal); + } + + private void mnuWindowsCascade_Click(object sender, EventArgs e) + { + LayoutMdi(MdiLayout.Cascade); + } } } \ No newline at end of file