This commit is contained in:
EggMan20339 2024-02-07 10:29:08 -05:00
parent cc5ff94fd3
commit 2671072f64
3 changed files with 81 additions and 6 deletions

View File

@ -48,7 +48,11 @@ namespace Chapter6
this.mnuWindowCloseAll = new System.Windows.Forms.ToolStripMenuItem(); this.mnuWindowCloseAll = new System.Windows.Forms.ToolStripMenuItem();
this.mnuHelp = new System.Windows.Forms.ToolStripMenuItem(); this.mnuHelp = new System.Windows.Forms.ToolStripMenuItem();
this.mnuHelpAbout = new System.Windows.Forms.ToolStripMenuItem(); this.mnuHelpAbout = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.lblUser = new System.Windows.Forms.ToolStripStatusLabel();
this.lblDateTime = new System.Windows.Forms.ToolStripStatusLabel();
this.Menu.SuspendLayout(); this.Menu.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// Menu // Menu
@ -86,7 +90,7 @@ namespace Chapter6
this.mnuEditCalculate.Name = "mnuEditCalculate"; this.mnuEditCalculate.Name = "mnuEditCalculate";
this.mnuEditCalculate.Size = new System.Drawing.Size(153, 22); this.mnuEditCalculate.Size = new System.Drawing.Size(153, 22);
this.mnuEditCalculate.Text = "Calculate"; this.mnuEditCalculate.Text = "Calculate";
this.mnuEditCalculate.Click += mnuEditCalculate_Click; this.mnuEditCalculate.Click += new System.EventHandler(this.mnuEditCalculate_Click);
// //
// mnuEditSummary // mnuEditSummary
// //
@ -123,35 +127,36 @@ namespace Chapter6
// mnuWindowArrangeIcons // mnuWindowArrangeIcons
// //
this.mnuWindowArrangeIcons.Name = "mnuWindowArrangeIcons"; this.mnuWindowArrangeIcons.Name = "mnuWindowArrangeIcons";
this.mnuWindowArrangeIcons.Size = new System.Drawing.Size(152, 22); this.mnuWindowArrangeIcons.Size = new System.Drawing.Size(147, 22);
this.mnuWindowArrangeIcons.Text = "Arrange Icons"; this.mnuWindowArrangeIcons.Text = "Arrange Icons";
// //
// mnuWindowsCascade // mnuWindowsCascade
// //
this.mnuWindowsCascade.Name = "mnuWindowsCascade"; this.mnuWindowsCascade.Name = "mnuWindowsCascade";
this.mnuWindowsCascade.Size = new System.Drawing.Size(152, 22); this.mnuWindowsCascade.Size = new System.Drawing.Size(147, 22);
this.mnuWindowsCascade.Text = "Cascade"; this.mnuWindowsCascade.Text = "Cascade";
this.mnuWindowsCascade.Click += new System.EventHandler(this.mnuWindowsCascade_Click); this.mnuWindowsCascade.Click += new System.EventHandler(this.mnuWindowsCascade_Click);
// //
// munWindowHorizontal // munWindowHorizontal
// //
this.munWindowHorizontal.Name = "munWindowHorizontal"; this.munWindowHorizontal.Name = "munWindowHorizontal";
this.munWindowHorizontal.Size = new System.Drawing.Size(152, 22); this.munWindowHorizontal.Size = new System.Drawing.Size(147, 22);
this.munWindowHorizontal.Text = "Horizontal"; this.munWindowHorizontal.Text = "Horizontal";
this.munWindowHorizontal.Click += new System.EventHandler(this.munWindowHorizontal_Click); this.munWindowHorizontal.Click += new System.EventHandler(this.munWindowHorizontal_Click);
// //
// mnuWindowVertical // mnuWindowVertical
// //
this.mnuWindowVertical.Name = "mnuWindowVertical"; this.mnuWindowVertical.Name = "mnuWindowVertical";
this.mnuWindowVertical.Size = new System.Drawing.Size(152, 22); this.mnuWindowVertical.Size = new System.Drawing.Size(147, 22);
this.mnuWindowVertical.Text = "Vertical"; this.mnuWindowVertical.Text = "Vertical";
this.mnuWindowVertical.Click += new System.EventHandler(this.mnuWindowVertical_Click); this.mnuWindowVertical.Click += new System.EventHandler(this.mnuWindowVertical_Click);
// //
// mnuWindowCloseAll // mnuWindowCloseAll
// //
this.mnuWindowCloseAll.Name = "mnuWindowCloseAll"; this.mnuWindowCloseAll.Name = "mnuWindowCloseAll";
this.mnuWindowCloseAll.Size = new System.Drawing.Size(152, 22); this.mnuWindowCloseAll.Size = new System.Drawing.Size(147, 22);
this.mnuWindowCloseAll.Text = "Close All"; this.mnuWindowCloseAll.Text = "Close All";
this.mnuWindowCloseAll.Click += new System.EventHandler(this.mnuWindowCloseAll_Click);
// //
// mnuHelp // mnuHelp
// //
@ -167,11 +172,34 @@ namespace Chapter6
this.mnuHelpAbout.Text = "About"; this.mnuHelpAbout.Text = "About";
this.mnuHelpAbout.Click += new System.EventHandler(this.mnuHelpAbout_Click); this.mnuHelpAbout.Click += new System.EventHandler(this.mnuHelpAbout_Click);
// //
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.lblUser, this.lblDateTime });
this.statusStrip1.Location = new System.Drawing.Point(0, 428);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(800, 22);
this.statusStrip1.TabIndex = 3;
this.statusStrip1.Text = "statusStrip1";
//
// lblUser
//
this.lblUser.Name = "lblUser";
this.lblUser.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.lblUser.Size = new System.Drawing.Size(0, 17);
this.lblUser.TextDirection = System.Windows.Forms.ToolStripTextDirection.Horizontal;
//
// lblDateTime
//
this.lblDateTime.Margin = new System.Windows.Forms.Padding(470, 3, 0, 2);
this.lblDateTime.Name = "lblDateTime";
this.lblDateTime.Size = new System.Drawing.Size(0, 17);
//
// frmMain // frmMain
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450); this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.Menu); this.Controls.Add(this.Menu);
this.IsMdiContainer = true; this.IsMdiContainer = true;
this.MainMenuStrip = this.Menu; this.MainMenuStrip = this.Menu;
@ -179,10 +207,18 @@ namespace Chapter6
this.Text = "MDI"; this.Text = "MDI";
this.Menu.ResumeLayout(false); this.Menu.ResumeLayout(false);
this.Menu.PerformLayout(); this.Menu.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
} }
private System.Windows.Forms.ToolStripStatusLabel lblDateTime;
private System.Windows.Forms.ToolStripStatusLabel lblUser;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripMenuItem mnuEditCalculate; private System.Windows.Forms.ToolStripMenuItem mnuEditCalculate;
private System.Windows.Forms.ToolStripMenuItem mnuEditSummary; private System.Windows.Forms.ToolStripMenuItem mnuEditSummary;
private System.Windows.Forms.ToolStripMenuItem mnuEditShowStudents; private System.Windows.Forms.ToolStripMenuItem mnuEditShowStudents;

View File

@ -1,13 +1,34 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using System.Security.Principal;
namespace Chapter6 namespace Chapter6
{ {
public partial class frmMain : Form public partial class frmMain : Form
{ {
private Timer timer;
public frmMain() public frmMain()
{ {
InitializeComponent(); InitializeComponent();
lblUser.Text = WindowsIdentity.GetCurrent().Name.ToString();
timer = new Timer
{
Interval = 1000
};
timer.Tick += Tick;
timer.Start();
}
private void Tick(object sender, EventArgs e)
{
lblDateTime.Text = DateTime.Now.ToString("f");
} }
private void mnuFileExit_Click(object sender, EventArgs e) private void mnuFileExit_Click(object sender, EventArgs e)
@ -88,5 +109,20 @@ namespace Chapter6
{ {
LayoutMdi(MdiLayout.Cascade); LayoutMdi(MdiLayout.Cascade);
} }
private void mnuWindowCloseAll_Click(object sender, EventArgs e)
{
foreach (var childform in MdiChildren)
{
childform.Close();
}
}
private void statusStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
}
} }
} }

View File

@ -120,4 +120,7 @@
<metadata name="Menu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="Menu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>97, 17</value>
</metadata>
</root> </root>