diff --git a/Chapter6/Chapter6.csproj b/Chapter6/Chapter6.csproj index 896ee03..8780960 100644 --- a/Chapter6/Chapter6.csproj +++ b/Chapter6/Chapter6.csproj @@ -58,6 +58,12 @@ frmSummary.cs + + Form + + + frmMain.cs + @@ -66,6 +72,9 @@ frmSummary.cs + + frmMain.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/Chapter6/Program.cs b/Chapter6/Program.cs index af940e1..6bb03e0 100644 --- a/Chapter6/Program.cs +++ b/Chapter6/Program.cs @@ -16,7 +16,7 @@ namespace Chapter6 { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new frmCalculate()); + Application.Run(new frmMain()); } } } \ No newline at end of file diff --git a/Chapter6/frmMain.Designer.cs b/Chapter6/frmMain.Designer.cs new file mode 100644 index 0000000..d61c546 --- /dev/null +++ b/Chapter6/frmMain.Designer.cs @@ -0,0 +1,201 @@ +using System.ComponentModel; + +namespace Chapter6 +{ + partial class frmMain + { + /// + /// 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.Menu = new System.Windows.Forms.MenuStrip(); + this.mnuFile = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuFileExit = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuEdit = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuEditCalculate = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuEditSummary = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuEditShowStudents = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuEditAddStudents = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuEditSearchStudent = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuWindow = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuWindowArrangeIcons = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuWindowsCascade = new System.Windows.Forms.ToolStripMenuItem(); + this.munWindowHorizontal = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuWindowVertical = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuWindowCloseAll = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuHelp = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuHelpAbout = new System.Windows.Forms.ToolStripMenuItem(); + this.Menu.SuspendLayout(); + this.SuspendLayout(); + // + // Menu + // + this.Menu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mnuFile, this.mnuEdit, this.mnuWindow, this.mnuHelp }); + this.Menu.Location = new System.Drawing.Point(0, 0); + this.Menu.Name = "Menu"; + this.Menu.Size = new System.Drawing.Size(800, 24); + this.Menu.TabIndex = 1; + this.Menu.Text = "menuStrip1"; + // + // mnuFile + // + this.mnuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mnuFileExit }); + this.mnuFile.Name = "mnuFile"; + this.mnuFile.Size = new System.Drawing.Size(37, 20); + this.mnuFile.Text = "File"; + // + // mnuFileExit + // + this.mnuFileExit.Name = "mnuFileExit"; + this.mnuFileExit.Size = new System.Drawing.Size(152, 22); + this.mnuFileExit.Text = "Exit"; + this.mnuFileExit.Click += new System.EventHandler(this.mnuFileExit_Click_1); + // + // mnuEdit + // + this.mnuEdit.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mnuEditCalculate, this.mnuEditSummary, this.mnuEditShowStudents, this.mnuEditAddStudents, this.mnuEditSearchStudent }); + this.mnuEdit.Name = "mnuEdit"; + this.mnuEdit.Size = new System.Drawing.Size(39, 20); + this.mnuEdit.Text = "Edit"; + // + // mnuEditCalculate + // + this.mnuEditCalculate.Name = "mnuEditCalculate"; + this.mnuEditCalculate.Size = new System.Drawing.Size(153, 22); + this.mnuEditCalculate.Text = "Calculate"; + // + // mnuEditSummary + // + this.mnuEditSummary.Name = "mnuEditSummary"; + this.mnuEditSummary.Size = new System.Drawing.Size(153, 22); + this.mnuEditSummary.Text = "Summary"; + // + // mnuEditShowStudents + // + this.mnuEditShowStudents.Name = "mnuEditShowStudents"; + this.mnuEditShowStudents.Size = new System.Drawing.Size(153, 22); + this.mnuEditShowStudents.Text = "Show Students"; + // + // mnuEditAddStudents + // + this.mnuEditAddStudents.Name = "mnuEditAddStudents"; + this.mnuEditAddStudents.Size = new System.Drawing.Size(153, 22); + this.mnuEditAddStudents.Text = "Add Students"; + // + // mnuEditSearchStudent + // + this.mnuEditSearchStudent.Name = "mnuEditSearchStudent"; + this.mnuEditSearchStudent.Size = new System.Drawing.Size(153, 22); + this.mnuEditSearchStudent.Text = "Search Student"; + // + // mnuWindow + // + this.mnuWindow.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mnuWindowArrangeIcons, this.mnuWindowsCascade, this.munWindowHorizontal, this.mnuWindowVertical, this.mnuWindowCloseAll }); + this.mnuWindow.Name = "mnuWindow"; + this.mnuWindow.Size = new System.Drawing.Size(63, 20); + this.mnuWindow.Text = "Window"; + // + // mnuWindowArrangeIcons + // + this.mnuWindowArrangeIcons.Name = "mnuWindowArrangeIcons"; + this.mnuWindowArrangeIcons.Size = new System.Drawing.Size(147, 22); + this.mnuWindowArrangeIcons.Text = "Arrange Icons"; + // + // mnuWindowsCascade + // + this.mnuWindowsCascade.Name = "mnuWindowsCascade"; + this.mnuWindowsCascade.Size = new System.Drawing.Size(147, 22); + this.mnuWindowsCascade.Text = "Cascade"; + // + // munWindowHorizontal + // + this.munWindowHorizontal.Name = "munWindowHorizontal"; + this.munWindowHorizontal.Size = new System.Drawing.Size(147, 22); + this.munWindowHorizontal.Text = "Horizontal"; + // + // mnuWindowVertical + // + this.mnuWindowVertical.Name = "mnuWindowVertical"; + this.mnuWindowVertical.Size = new System.Drawing.Size(147, 22); + this.mnuWindowVertical.Text = "Vertical"; + // + // mnuWindowCloseAll + // + this.mnuWindowCloseAll.Name = "mnuWindowCloseAll"; + this.mnuWindowCloseAll.Size = new System.Drawing.Size(147, 22); + this.mnuWindowCloseAll.Text = "Close All"; + // + // mnuHelp + // + this.mnuHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mnuHelpAbout }); + this.mnuHelp.Name = "mnuHelp"; + this.mnuHelp.Size = new System.Drawing.Size(44, 20); + this.mnuHelp.Text = "Help"; + // + // mnuHelpAbout + // + this.mnuHelpAbout.Name = "mnuHelpAbout"; + this.mnuHelpAbout.Size = new System.Drawing.Size(107, 22); + this.mnuHelpAbout.Text = "About"; + // + // frmMain + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.Menu); + this.IsMdiContainer = true; + this.MainMenuStrip = this.Menu; + this.Name = "frmMain"; + this.Text = "MDI"; + this.Menu.ResumeLayout(false); + this.Menu.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + } + + private System.Windows.Forms.ToolStripMenuItem mnuEditCalculate; + private System.Windows.Forms.ToolStripMenuItem mnuEditSummary; + private System.Windows.Forms.ToolStripMenuItem mnuEditShowStudents; + private System.Windows.Forms.ToolStripMenuItem mnuEditAddStudents; + private System.Windows.Forms.ToolStripMenuItem mnuEditSearchStudent; + private System.Windows.Forms.ToolStripMenuItem mnuWindow; + private System.Windows.Forms.ToolStripMenuItem mnuWindowArrangeIcons; + private System.Windows.Forms.ToolStripMenuItem mnuWindowsCascade; + private System.Windows.Forms.ToolStripMenuItem munWindowHorizontal; + private System.Windows.Forms.ToolStripMenuItem mnuWindowVertical; + private System.Windows.Forms.ToolStripMenuItem mnuWindowCloseAll; + private System.Windows.Forms.ToolStripMenuItem mnuHelp; + private System.Windows.Forms.ToolStripMenuItem mnuHelpAbout; + + private System.Windows.Forms.MenuStrip Menu; + private System.Windows.Forms.ToolStripMenuItem mnuFile; + private System.Windows.Forms.ToolStripMenuItem mnuFileExit; + private System.Windows.Forms.ToolStripMenuItem mnuEdit; + + #endregion + } +} \ No newline at end of file diff --git a/Chapter6/frmMain.cs b/Chapter6/frmMain.cs new file mode 100644 index 0000000..560b6fd --- /dev/null +++ b/Chapter6/frmMain.cs @@ -0,0 +1,23 @@ +using System; +using System.Windows.Forms; + +namespace Chapter6 +{ + public partial class frmMain : Form + { + public frmMain() + { + InitializeComponent(); + } + + private void mnuFileExit_Click(object sender, EventArgs e) + { + Close(); + } + + private void mnuFileExit_Click_1(object sender, EventArgs e) + { + Close(); + } + } +} \ No newline at end of file diff --git a/Chapter6/frmMain.resx b/Chapter6/frmMain.resx new file mode 100644 index 0000000..5b57c07 --- /dev/null +++ b/Chapter6/frmMain.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + 17, 17 + + \ No newline at end of file diff --git a/MDI/App.config b/MDI/App.config new file mode 100644 index 0000000..787dcbe --- /dev/null +++ b/MDI/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MDI/Chapter6.csproj b/MDI/Chapter6.csproj new file mode 100644 index 0000000..896ee03 --- /dev/null +++ b/MDI/Chapter6.csproj @@ -0,0 +1,92 @@ + + + + + Debug + AnyCPU + {A7E2FD06-A779-43A4-B838-262A2A840A63} + WinExe + Chapter6 + Chapter6 + v4.7.1 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + frmCalculate.cs + + + Form + + + frmSummary.cs + + + + + frmCalculate.cs + + + frmSummary.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/MDI/Program.cs b/MDI/Program.cs new file mode 100644 index 0000000..af940e1 --- /dev/null +++ b/MDI/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Chapter6 +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new frmCalculate()); + } + } +} \ No newline at end of file diff --git a/MDI/Properties/AssemblyInfo.cs b/MDI/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0a62598 --- /dev/null +++ b/MDI/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Chapter6")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Chapter6")] +[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("A7E2FD06-A779-43A4-B838-262A2A840A63")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/MDI/Properties/Resources.Designer.cs b/MDI/Properties/Resources.Designer.cs new file mode 100644 index 0000000..92a08fc --- /dev/null +++ b/MDI/Properties/Resources.Designer.cs @@ -0,0 +1,69 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Chapter6.Properties +{ + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", + "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", + "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState + .Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = + new global::System.Resources.ResourceManager("Chapter6.Properties.Resources", + typeof(Resources).Assembly); + resourceMan = temp; + } + + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState + .Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get { return resourceCulture; } + set { resourceCulture = value; } + } + } +} \ No newline at end of file diff --git a/MDI/Properties/Resources.resx b/MDI/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/MDI/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/MDI/Properties/Settings.Designer.cs b/MDI/Properties/Settings.Designer.cs new file mode 100644 index 0000000..175be7c --- /dev/null +++ b/MDI/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Chapter6.Properties +{ + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute( + "Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + private static Settings defaultInstance = + ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get { return defaultInstance; } + } + } +} \ No newline at end of file diff --git a/MDI/Properties/Settings.settings b/MDI/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/MDI/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/MDI/frmCalculate.Designer.cs b/MDI/frmCalculate.Designer.cs new file mode 100644 index 0000000..2c6b29c --- /dev/null +++ b/MDI/frmCalculate.Designer.cs @@ -0,0 +1,247 @@ +using System.ComponentModel; + +namespace Chapter6 +{ + partial class frmCalculate + { + /// + /// 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.btnCalc = new System.Windows.Forms.Button(); + this.lblOut = new System.Windows.Forms.Label(); + this.txtDiscount = new System.Windows.Forms.TextBox(); + this.txtPrice = new System.Windows.Forms.TextBox(); + this.txtQuantity = new System.Windows.Forms.TextBox(); + this.lblDisQuantity = new System.Windows.Forms.Label(); + this.lblDisPrice = new System.Windows.Forms.Label(); + this.lblDisDiscount = new System.Windows.Forms.Label(); + this.miniToolStrip = new System.Windows.Forms.MenuStrip(); + this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuMain = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuFileExit = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuEdit = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuEditCalculate = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuEditSSummary = new System.Windows.Forms.ToolStripMenuItem(); + this.windowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.miniToolStrip.SuspendLayout(); + this.mnuMain.SuspendLayout(); + this.SuspendLayout(); + // + // btnCalc + // + this.btnCalc.Location = new System.Drawing.Point(235, 189); + this.btnCalc.Name = "btnCalc"; + this.btnCalc.Size = new System.Drawing.Size(125, 34); + this.btnCalc.TabIndex = 0; + this.btnCalc.Text = "Calculate"; + this.btnCalc.UseVisualStyleBackColor = true; + this.btnCalc.Click += new System.EventHandler(this.btnCalc_Click); + // + // lblOut + // + this.lblOut.BackColor = System.Drawing.SystemColors.Info; + this.lblOut.Location = new System.Drawing.Point(234, 154); + this.lblOut.Name = "lblOut"; + this.lblOut.Size = new System.Drawing.Size(125, 25); + this.lblOut.TabIndex = 1; + // + // txtDiscount + // + this.txtDiscount.Location = new System.Drawing.Point(235, 110); + this.txtDiscount.Name = "txtDiscount"; + this.txtDiscount.Size = new System.Drawing.Size(125, 20); + this.txtDiscount.TabIndex = 2; + // + // txtPrice + // + this.txtPrice.Location = new System.Drawing.Point(234, 84); + this.txtPrice.Name = "txtPrice"; + this.txtPrice.Size = new System.Drawing.Size(125, 20); + this.txtPrice.TabIndex = 3; + // + // txtQuantity + // + this.txtQuantity.Location = new System.Drawing.Point(235, 58); + this.txtQuantity.Name = "txtQuantity"; + this.txtQuantity.Size = new System.Drawing.Size(125, 20); + this.txtQuantity.TabIndex = 4; + // + // lblDisQuantity + // + this.lblDisQuantity.Location = new System.Drawing.Point(81, 61); + this.lblDisQuantity.Name = "lblDisQuantity"; + this.lblDisQuantity.Size = new System.Drawing.Size(148, 19); + this.lblDisQuantity.TabIndex = 5; + this.lblDisQuantity.Text = "Quantity:"; + this.lblDisQuantity.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // lblDisPrice + // + this.lblDisPrice.Location = new System.Drawing.Point(81, 84); + this.lblDisPrice.Name = "lblDisPrice"; + this.lblDisPrice.Size = new System.Drawing.Size(148, 19); + this.lblDisPrice.TabIndex = 6; + this.lblDisPrice.Text = "Price:"; + this.lblDisPrice.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // lblDisDiscount + // + this.lblDisDiscount.Location = new System.Drawing.Point(81, 110); + this.lblDisDiscount.Name = "lblDisDiscount"; + this.lblDisDiscount.Size = new System.Drawing.Size(148, 19); + this.lblDisDiscount.TabIndex = 7; + this.lblDisDiscount.Text = "Discount (%):"; + this.lblDisDiscount.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // miniToolStrip + // + this.miniToolStrip.AutoSize = false; + this.miniToolStrip.Dock = System.Windows.Forms.DockStyle.None; + this.miniToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripMenuItem1 }); + this.miniToolStrip.Location = new System.Drawing.Point(131, 2); + this.miniToolStrip.Name = "miniToolStrip"; + this.miniToolStrip.Size = new System.Drawing.Size(800, 24); + this.miniToolStrip.TabIndex = 8; + this.miniToolStrip.Visible = false; + // + // toolStripMenuItem1 + // + this.toolStripMenuItem1.Name = "toolStripMenuItem1"; + this.toolStripMenuItem1.Size = new System.Drawing.Size(125, 20); + this.toolStripMenuItem1.Text = "toolStripMenuItem1"; + this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click); + // + // mnuMain + // + this.mnuMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem, this.mnuEdit, this.windowToolStripMenuItem, this.helpToolStripMenuItem }); + this.mnuMain.Location = new System.Drawing.Point(0, 0); + this.mnuMain.Name = "mnuMain"; + this.mnuMain.Size = new System.Drawing.Size(800, 24); + this.mnuMain.TabIndex = 9; + this.mnuMain.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mnuFileExit }); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "File"; + // + // mnuFileExit + // + this.mnuFileExit.Name = "mnuFileExit"; + this.mnuFileExit.Size = new System.Drawing.Size(93, 22); + this.mnuFileExit.Text = "Exit"; + // + // mnuEdit + // + this.mnuEdit.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mnuEditCalculate, this.mnuEditSSummary }); + this.mnuEdit.Name = "mnuEdit"; + this.mnuEdit.Size = new System.Drawing.Size(39, 20); + this.mnuEdit.Text = "Edit"; + // + // mnuEditCalculate + // + this.mnuEditCalculate.Name = "mnuEditCalculate"; + this.mnuEditCalculate.Size = new System.Drawing.Size(157, 22); + this.mnuEditCalculate.Text = "Calculate"; + this.mnuEditCalculate.Click += new System.EventHandler(this.mnuEditCalculate_Click); + // + // mnuEditSSummary + // + this.mnuEditSSummary.Name = "mnuEditSSummary"; + this.mnuEditSSummary.Size = new System.Drawing.Size(157, 22); + this.mnuEditSSummary.Text = "Show Summary"; + this.mnuEditSSummary.Click += new System.EventHandler(this.mnuEditSSummary_Click); + // + // windowToolStripMenuItem + // + this.windowToolStripMenuItem.Name = "windowToolStripMenuItem"; + this.windowToolStripMenuItem.Size = new System.Drawing.Size(63, 20); + this.windowToolStripMenuItem.Text = "Window"; + // + // helpToolStripMenuItem + // + this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; + this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); + this.helpToolStripMenuItem.Text = "Help"; + // + // frmCalculate + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.Control; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.lblDisDiscount); + this.Controls.Add(this.lblDisPrice); + this.Controls.Add(this.lblDisQuantity); + this.Controls.Add(this.txtQuantity); + this.Controls.Add(this.txtPrice); + this.Controls.Add(this.txtDiscount); + this.Controls.Add(this.lblOut); + this.Controls.Add(this.btnCalc); + this.Controls.Add(this.miniToolStrip); + this.Controls.Add(this.mnuMain); + this.Location = new System.Drawing.Point(15, 15); + this.MainMenuStrip = this.mnuMain; + this.Name = "frmCalculate"; + this.miniToolStrip.ResumeLayout(false); + this.miniToolStrip.PerformLayout(); + this.mnuMain.ResumeLayout(false); + this.mnuMain.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + } + + private System.Windows.Forms.MenuStrip miniToolStrip; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem mnuEdit; + private System.Windows.Forms.ToolStripMenuItem mnuEditCalculate; + private System.Windows.Forms.ToolStripMenuItem mnuEditSSummary; + private System.Windows.Forms.ToolStripMenuItem windowToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem mnuFileExit; + + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; + + private System.Windows.Forms.MenuStrip mnuMain; + + private System.Windows.Forms.TextBox txtDiscount; + private System.Windows.Forms.TextBox txtPrice; + private System.Windows.Forms.TextBox txtQuantity; + private System.Windows.Forms.Label lblDisQuantity; + private System.Windows.Forms.Label lblDisPrice; + private System.Windows.Forms.Label lblDisDiscount; + + private System.Windows.Forms.Button btnCalc; + private System.Windows.Forms.Label lblOut; + + #endregion + } +} \ No newline at end of file diff --git a/MDI/frmCalculate.cs b/MDI/frmCalculate.cs new file mode 100644 index 0000000..bd76515 --- /dev/null +++ b/MDI/frmCalculate.cs @@ -0,0 +1,114 @@ +using System; +using System.Windows.Forms; + +namespace Chapter6 +{ + public partial class frmCalculate : Form + { + + public static decimal decDiscountAmt, decTotalPrice, decTotalAmnt = 0; + public static int intTotalQuantity = 0; + + public frmCalculate() + { + InitializeComponent(); + } + + private void lblDisQuantity_Click(object sender, EventArgs e) + { + // throw new System.NotImplementedException(); + } + + private decimal Calculate(int quantity, decimal price, decimal discount) + { + + return (quantity * price) * (1 - (discount - 100)); + + } + + private void btnCalc_Click(object sender, EventArgs e) + { + int intQuantity = 0; + decimal decPrice = 0; + decimal decDiscount = 0; + + try + { + + + intQuantity = int.Parse(txtQuantity.Text); + + try + { + + + decPrice = int.Parse(txtPrice.Text); + + try + { + + + decDiscount = int.Parse(txtDiscount.Text); + + lblOut.Text = Calculate(intQuantity, decPrice, decDiscount).ToString("C"); + + } + catch (Exception exception) + { + //discount error + } + + + } + catch (Exception exception) + { + //price error + } + + + } + catch (Exception exception) + { + //quantity Error + } + } + + private void toolStripMenuItem1_Click(object sender, EventArgs e) + { + // throw new System.NotImplementedException(); + } + + private void mnuEditCalculate_Click(object sender, EventArgs e) + { + if (mnuEditCalculate.Checked) + { + mnuEdit.Checked = false; + } + else + { + mnuEditCalculate.Checked = true; + } + } + + + + + + private void mnuEditSSummary_Click(object sender, EventArgs e) + { + + if (mnuEditSSummary.Checked) + { + mnuEditSSummary.Checked = false; + } + else + { + mnuEditSSummary.Checked = true; + frmSummary frm = new frmSummary(); + frm.Show(); + frm.Focus(); + } + + } + } +} \ No newline at end of file diff --git a/MDI/frmCalculate.resx b/MDI/frmCalculate.resx new file mode 100644 index 0000000..69bce91 --- /dev/null +++ b/MDI/frmCalculate.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + 17, 17 + + + 135, 17 + + \ No newline at end of file diff --git a/MDI/frmSummary.Designer.cs b/MDI/frmSummary.Designer.cs new file mode 100644 index 0000000..a5ee762 --- /dev/null +++ b/MDI/frmSummary.Designer.cs @@ -0,0 +1,147 @@ +using System.ComponentModel; + +namespace Chapter6 +{ + partial class frmSummary + { + /// + /// 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.lblQuantity = new System.Windows.Forms.Label(); + this.lblPrice = new System.Windows.Forms.Label(); + this.lblDiscount = new System.Windows.Forms.Label(); + this.lblTotal = new System.Windows.Forms.Label(); + this.lblDisTotal = new System.Windows.Forms.Label(); + this.lblDisDiscount = new System.Windows.Forms.Label(); + this.lblDisPrice = new System.Windows.Forms.Label(); + this.lblDisQuantity = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // lblQuantity + // + this.lblQuantity.BackColor = System.Drawing.SystemColors.Info; + this.lblQuantity.Location = new System.Drawing.Point(298, 137); + this.lblQuantity.Name = "lblQuantity"; + this.lblQuantity.Size = new System.Drawing.Size(128, 29); + this.lblQuantity.TabIndex = 0; + this.lblQuantity.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // lblPrice + // + this.lblPrice.BackColor = System.Drawing.SystemColors.Info; + this.lblPrice.Location = new System.Drawing.Point(298, 166); + this.lblPrice.Name = "lblPrice"; + this.lblPrice.Size = new System.Drawing.Size(128, 29); + this.lblPrice.TabIndex = 1; + this.lblPrice.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // lblDiscount + // + this.lblDiscount.BackColor = System.Drawing.SystemColors.Info; + this.lblDiscount.Location = new System.Drawing.Point(298, 195); + this.lblDiscount.Name = "lblDiscount"; + this.lblDiscount.Size = new System.Drawing.Size(128, 29); + this.lblDiscount.TabIndex = 2; + this.lblDiscount.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // lblTotal + // + this.lblTotal.BackColor = System.Drawing.SystemColors.Info; + this.lblTotal.Location = new System.Drawing.Point(298, 224); + this.lblTotal.Name = "lblTotal"; + this.lblTotal.Size = new System.Drawing.Size(128, 29); + this.lblTotal.TabIndex = 3; + this.lblTotal.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // lblDisTotal + // + this.lblDisTotal.BackColor = System.Drawing.SystemColors.Control; + this.lblDisTotal.Location = new System.Drawing.Point(146, 224); + this.lblDisTotal.Name = "lblDisTotal"; + this.lblDisTotal.Size = new System.Drawing.Size(128, 29); + this.lblDisTotal.TabIndex = 7; + this.lblDisTotal.Text = "Total Sale"; + this.lblDisTotal.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // lblDisDiscount + // + this.lblDisDiscount.Location = new System.Drawing.Point(146, 195); + this.lblDisDiscount.Name = "lblDisDiscount"; + this.lblDisDiscount.Size = new System.Drawing.Size(128, 29); + this.lblDisDiscount.TabIndex = 6; + this.lblDisDiscount.Text = "Discount"; + this.lblDisDiscount.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // lblDisPrice + // + this.lblDisPrice.Location = new System.Drawing.Point(146, 166); + this.lblDisPrice.Name = "lblDisPrice"; + this.lblDisPrice.Size = new System.Drawing.Size(128, 29); + this.lblDisPrice.TabIndex = 5; + this.lblDisPrice.Text = "Price"; + this.lblDisPrice.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // lblDisQuantity + // + this.lblDisQuantity.Location = new System.Drawing.Point(146, 137); + this.lblDisQuantity.Name = "lblDisQuantity"; + this.lblDisQuantity.Size = new System.Drawing.Size(128, 29); + this.lblDisQuantity.TabIndex = 4; + this.lblDisQuantity.Text = "Quantity"; + this.lblDisQuantity.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // frmSummary + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.lblDisTotal); + this.Controls.Add(this.lblDisDiscount); + this.Controls.Add(this.lblDisPrice); + this.Controls.Add(this.lblDisQuantity); + this.Controls.Add(this.lblTotal); + this.Controls.Add(this.lblDiscount); + this.Controls.Add(this.lblPrice); + this.Controls.Add(this.lblQuantity); + this.Name = "frmSummary"; + this.Text = "frmSummary"; + this.ResumeLayout(false); + } + + private System.Windows.Forms.Label lblDisTotal; + private System.Windows.Forms.Label lblDisDiscount; + private System.Windows.Forms.Label lblDisPrice; + private System.Windows.Forms.Label lblDisQuantity; + + private System.Windows.Forms.Label lblQuantity; + private System.Windows.Forms.Label lblPrice; + private System.Windows.Forms.Label lblDiscount; + private System.Windows.Forms.Label lblTotal; + + #endregion + } +} \ No newline at end of file diff --git a/MDI/frmSummary.cs b/MDI/frmSummary.cs new file mode 100644 index 0000000..60c4d2a --- /dev/null +++ b/MDI/frmSummary.cs @@ -0,0 +1,22 @@ +using System; +using System.Windows.Forms; + +namespace Chapter6 +{ + public partial class frmSummary : Form + { + public frmSummary() + { + InitializeComponent(); + // this.FormClosing += new FormClosingEventHandler(FrmSummary_FormClosing); + this.Activated += new EventHandler(frmSummary_Activated); + } + + private void frmSummary_Activated(object sender, EventArgs e) + { + + + + } + } +} \ No newline at end of file diff --git a/MDI/frmSummary.resx b/MDI/frmSummary.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/MDI/frmSummary.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