实例:
-
using System;
-
using System.Collections.Generic;
-
using System.ComponentModel;
-
using System.Data;
-
using System.Drawing;
-
using System.Linq;
-
using System.Text;
-
using System.Windows.Forms;
-
using System.Reflection;
-
-
namespace MIS
-
{
-
public partial class MISMain : Form
-
{
-
public MISMain()
-
{
-
InitializeComponent();
-
}
-
-
private bool HaveOpened(Form MainMDI, string ParentMDI)
-
{
-
//查看窗口是否已经被打开
-
bool bReturn = true;
-
for (int i = 0; i < MainMDI.MdiChildren.Length; i++)
-
{
-
if (MainMDI.MdiChildren[i].Name == ParentMDI)
-
{
-
MainMDI.MdiChildren[i].BringToFront();
-
bReturn = false;
-
break;
-
}
-
}
-
return bReturn;
-
}
-
-
private void CascadeToolStripMenuItem_Click(object sender, EventArgs e)
-
{
-
LayoutMdi(MdiLayout.Cascade);
-
}
-
-
private void TileVerticalToolStripMenuItem_Click(object sender, EventArgs e)
-
{
-
LayoutMdi(MdiLayout.TileVertical);
-
}
-
-
private void TileHorizontalToolStripMenuItem_Click(object sender, EventArgs e)
-
{
-
LayoutMdi(MdiLayout.TileHorizontal);
-
}
-
-
private void CloseAllToolStripMenuItem_Click(object sender, EventArgs e)
-
{
-
foreach (Form childForm in MdiChildren)
-
{
-
childForm.Close();
-
}
-
}
-
-
private void MiniAllToolStripMenuItem_Click(object sender, EventArgs e)
-
{
-
-
}
-
-
private void ExitToolStripMenuItem_Click(object sender, EventArgs e)
-
{
-
Application.ExitThread();
-
}
-
-
private void AboutThisToolStripMenuItem_Click(object sender, EventArgs e)
-
{
-
AboutBox at = new AboutBox();
-
at.Show();
-
}
-
-
private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
-
{
-
}
-
-
private void MISMain_Load(object sender, EventArgs e)
-
{
-
//获取当前系统封装版本 toolStripStatusLabel1
-
this.toolStripStatusLabel1.Text = "版本: " +Environment.AssemblyVersion;
-
//动态显示当前时间 toolStripStatusLabel2
-
this.toolStripStatusLabel2.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
-
this.timer1.Interval = 1000;
-
this.timer1.Start();
-
//从全局静态类中得到传递过来的变量UserName toolStripStatusLabel4
-
this.toolStripStatusLabel4.Text = "登录用户:"+ GlobalInfo.LoginUser;
-
//toolStripStatusLabel5得到系统封装程序集系统名称
-
this.toolStripStatusLabel5.Text =Environment.AssemblyProduct;
-
//toolStripStatusLabel6 用于显示授权信息
-
this.toolStripStatusLabel6.Text = "授权给:" + Environment.AssemblyCompany;
-
}
-
-
private void timer1_Tick(object sender, EventArgs e)
-
{
-
this.toolStripStatusLabel2.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
-
}
-
-
private void 密码更改ToolStripMenuItem_Click(object sender, EventArgs e)
-
{
-
PwdModify f1 = new PwdModify();
-
if (HaveOpened(this, "PwdModify"))
-
{
-
f1.MdiParent = this;
-
f1.Show();
-
}
-
}
-
-
private void 注册用户ToolStripMenuItem_Click(object sender, EventArgs e)
-
{
-
RegisterAccount f1 = new RegisterAccount();
-
if (HaveOpened(this, "RegisterAccount"))
-
{
-
f1.MdiParent = this;
-
f1.Show();
-
}
-
}
-
-
private void 考勤报表查询ToolStripMenuItem_Click(object sender, EventArgs e)
-
{
-
reportview f1 = new reportview();
-
if (HaveOpened(this, "reportview"))
-
{
-
f1.MdiParent = this;
-
f1.Show();
-
}
-
}
-
-
private void databaseConfigToolStripMenuItem_Click(object sender, EventArgs e)
-
{
-
ServerConfig f1 = new ServerConfig();
-
if (HaveOpened(this, "ServerConfig"))
-
{
-
f1.MdiParent = this;
-
f1.Show();
-
}
-
}
-
-
private void UsersToolStripMenuItem_Click(object sender, EventArgs e)
-
{
-
Userlist f1 = new Userlist();
-
if(HaveOpened(this,"Userlist"))
-
{
-
f1.MdiParent = this;
-
f1.Show();
-
}
-
}
-
-
private void AttendviewToolStripMenuItem_Click(object sender, EventArgs e)
-
{
-
AttendView f1 = new AttendView();
-
if (HaveOpened(this, "AttendView"))
-
{
-
f1.MdiParent = this;
-
f1.Show();
-
}
-
}
-
}
-
}
阅读(1232) | 评论(0) | 转发(0) |