128 lines
2.9 KiB
C#
128 lines
2.9 KiB
C#
using System;
|
|
using System.Windows.Forms;
|
|
using System.Security.Principal;
|
|
|
|
namespace Chapter6
|
|
{
|
|
public partial class frmMain : Form
|
|
{
|
|
|
|
private Timer timer;
|
|
public frmMain()
|
|
{
|
|
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)
|
|
{
|
|
Close();
|
|
}
|
|
|
|
private void mnuFileExit_Click_1(object sender, EventArgs e)
|
|
{
|
|
Close();
|
|
}
|
|
|
|
private void mnuEditCalculate_Click(object sender, EventArgs e)
|
|
{
|
|
frmCalculate aform = new frmCalculate();
|
|
|
|
mnuFile.Visible = true;
|
|
mnuEditSummary.Enabled = true;
|
|
|
|
|
|
aform.MdiParent = this;
|
|
aform.StartPosition = FormStartPosition.CenterParent;
|
|
aform.Show();
|
|
aform.Focus();
|
|
|
|
mnuEditCalculate.Checked = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
private void mnuEditSummary_Click(object sender, EventArgs e)
|
|
{
|
|
frmSummary aform = new frmSummary();
|
|
|
|
mnuFile.Visible = true;
|
|
|
|
|
|
|
|
aform.MdiParent = this;
|
|
aform.StartPosition = FormStartPosition.CenterParent;
|
|
aform.Show();
|
|
aform.Focus();
|
|
|
|
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);
|
|
}
|
|
|
|
private void mnuWindowCloseAll_Click(object sender, EventArgs e)
|
|
{
|
|
foreach (var childform in MdiChildren)
|
|
{
|
|
|
|
childform.Close();
|
|
|
|
}
|
|
}
|
|
|
|
private void statusStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
|
|
{
|
|
|
|
}
|
|
}
|
|
} |