Chinaunix首页 | 论坛 | 博客
  • 博客访问: 526935
  • 博文数量: 88
  • 博客积分: 2256
  • 博客等级: 大尉
  • 技术积分: 921
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-08 23:20
个人简介

积硅步,行千里

文章分类

全部博文(88)

文章存档

2019年(5)

2018年(1)

2016年(15)

2015年(23)

2013年(3)

2012年(6)

2011年(3)

2010年(22)

2009年(10)

我的朋友

分类: C#/.net

2015-10-29 14:28:58

实例:


  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Reflection;

  10. namespace MIS
  11. {
  12.     public partial class MISMain : Form
  13.     {
  14.         public MISMain()
  15.         {
  16.             InitializeComponent();
  17.         }

  18.         private bool HaveOpened(Form MainMDI, string ParentMDI)
  19.         {
  20.             //查看窗口是否已经被打开
  21.             bool bReturn = true;
  22.             for (int i = 0; i < MainMDI.MdiChildren.Length; i++)
  23.             {
  24.                 if (MainMDI.MdiChildren[i].Name == ParentMDI)
  25.                 {
  26.                     MainMDI.MdiChildren[i].BringToFront();
  27.                     bReturn = false;
  28.                     break;
  29.                 }
  30.             }
  31.             return bReturn;
  32.         }

  33.         private void CascadeToolStripMenuItem_Click(object sender, EventArgs e)
  34.         {
  35.             LayoutMdi(MdiLayout.Cascade);
  36.         }

  37.         private void TileVerticalToolStripMenuItem_Click(object sender, EventArgs e)
  38.         {
  39.             LayoutMdi(MdiLayout.TileVertical);
  40.         }

  41.         private void TileHorizontalToolStripMenuItem_Click(object sender, EventArgs e)
  42.         {
  43.             LayoutMdi(MdiLayout.TileHorizontal);
  44.         }

  45.         private void CloseAllToolStripMenuItem_Click(object sender, EventArgs e)
  46.         {
  47.             foreach (Form childForm in MdiChildren)
  48.             {
  49.                 childForm.Close();
  50.             }
  51.         }

  52.         private void MiniAllToolStripMenuItem_Click(object sender, EventArgs e)
  53.         {

  54.         }

  55.         private void ExitToolStripMenuItem_Click(object sender, EventArgs e)
  56.         {
  57.             Application.ExitThread();
  58.         }

  59.         private void AboutThisToolStripMenuItem_Click(object sender, EventArgs e)
  60.         {
  61.             AboutBox at = new AboutBox();
  62.             at.Show();
  63.         }

  64.         private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  65.         {
  66.         }

  67.         private void MISMain_Load(object sender, EventArgs e)
  68.         {
  69.             //获取当前系统封装版本 toolStripStatusLabel1
  70.             this.toolStripStatusLabel1.Text = "版本: " +Environment.AssemblyVersion;
  71.             //动态显示当前时间 toolStripStatusLabel2
  72.             this.toolStripStatusLabel2.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
  73.             this.timer1.Interval = 1000;
  74.             this.timer1.Start();
  75.             //从全局静态类中得到传递过来的变量UserName toolStripStatusLabel4
  76.             this.toolStripStatusLabel4.Text = "登录用户:"+ GlobalInfo.LoginUser;
  77.             //toolStripStatusLabel5得到系统封装程序集系统名称
  78.             this.toolStripStatusLabel5.Text =Environment.AssemblyProduct;
  79.             //toolStripStatusLabel6 用于显示授权信息
  80.             this.toolStripStatusLabel6.Text = "授权给:" + Environment.AssemblyCompany;
  81.         }

  82.         private void timer1_Tick(object sender, EventArgs e)
  83.         {
  84.             this.toolStripStatusLabel2.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
  85.         }

  86.         private void 密码更改ToolStripMenuItem_Click(object sender, EventArgs e)
  87.         {
  88.             PwdModify f1 = new PwdModify();
  89.             if (HaveOpened(this, "PwdModify"))
  90.             {
  91.                 f1.MdiParent = this;
  92.                 f1.Show();
  93.             }
  94.         }

  95.         private void 注册用户ToolStripMenuItem_Click(object sender, EventArgs e)
  96.         {
  97.             RegisterAccount f1 = new RegisterAccount();
  98.             if (HaveOpened(this, "RegisterAccount"))
  99.             {
  100.                 f1.MdiParent = this;
  101.                 f1.Show();
  102.             }
  103.         }

  104.         private void 考勤报表查询ToolStripMenuItem_Click(object sender, EventArgs e)
  105.         {
  106.             reportview f1 = new reportview();
  107.             if (HaveOpened(this, "reportview"))
  108.             {
  109.                 f1.MdiParent = this;
  110.                 f1.Show();
  111.             }
  112.         }

  113.         private void databaseConfigToolStripMenuItem_Click(object sender, EventArgs e)
  114.         {
  115.             ServerConfig f1 = new ServerConfig();
  116.             if (HaveOpened(this, "ServerConfig"))
  117.             {
  118.                 f1.MdiParent = this;
  119.                 f1.Show();
  120.             }
  121.         }

  122.         private void UsersToolStripMenuItem_Click(object sender, EventArgs e)
  123.         {
  124.             Userlist f1 = new Userlist();
  125.             if(HaveOpened(this,"Userlist"))
  126.             {
  127.                 f1.MdiParent = this;
  128.                 f1.Show();
  129.             }
  130.         }

  131.         private void AttendviewToolStripMenuItem_Click(object sender, EventArgs e)
  132.         {
  133.             AttendView f1 = new AttendView();
  134.             if (HaveOpened(this, "AttendView"))
  135.             {
  136.                 f1.MdiParent = this;
  137.                 f1.Show();
  138.             }
  139.         }
  140.     }
  141. }

阅读(1208) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~