学生信息管理前台代码

 using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace 学生信息管理
{
 /// <summary>
 /// Form1 的摘要说明。
 /// </summary>
 public class FormMain : System.Windows.Forms.Form
 {
  private System.Windows.Forms.ToolBar toolBarObj;
  private System.Windows.Forms.ImageList imgObj;
  private System.Windows.Forms.ToolBarButton tbrBtnAddStuInfo;
  private System.Windows.Forms.ToolBarButton tbrBtnSperator1;
  private System.Windows.Forms.ToolBarButton tbrBtnSeperator2;
  private System.Windows.Forms.ToolBarButton tbrBtnSelectStuInfo;
  private System.Windows.Forms.ToolBarButton tbrBtnSeperator3;
  private System.Windows.Forms.ToolBarButton tbrBtnUpdateStuInfo;
  private System.Windows.Forms.StatusBar sbrObj;
  private System.Windows.Forms.StatusBarPanel sbrpnlTime;
  private System.Windows.Forms.StatusBarPanel sbrpnlStatus;
  private System.Windows.Forms.StatusBarPanel sbrpnlProdesigner;
  private System.Windows.Forms.ToolBarButton tbrBtnDelStuInfo;
  private System.ComponentModel.IContainer components;
  private System.Windows.Forms.ToolBarButton tbrBtnSeperator4;
  private System.Windows.Forms.ToolBarButton tbrBtnWindowStyle;
  private System.Windows.Forms.ContextMenu contentMnu;
  private System.Windows.Forms.MenuItem menuItem1;
  private System.Windows.Forms.MenuItem menuItem2;
  private System.Windows.Forms.MenuItem menuItem3;
  public String environmentpath = Environment.CurrentDirectory;
  private System.Windows.Forms.ProgressBar prgfesser;  //取得当前环境的路径
  public static String path = Environment.CurrentDirectory;
  

  public FormMain()
  {
   //
   // Windows 窗体设计器支持所必需的
   //
   InitializeComponent();

   //
   // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
   //
  }

  /// <summary>
  /// 清理所有正在使用的资源。
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if (components != null)
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }

  #region Windows 窗体设计器生成的代码
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {
   this.components = new System.ComponentModel.Container();
   System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FormMain));
   this.toolBarObj = new System.Windows.Forms.ToolBar();
   this.tbrBtnAddStuInfo = new System.Windows.Forms.ToolBarButton();
   this.tbrBtnSperator1 = new System.Windows.Forms.ToolBarButton();
   this.tbrBtnDelStuInfo = new System.Windows.Forms.ToolBarButton();
   this.tbrBtnSeperator2 = new System.Windows.Forms.ToolBarButton();
   this.tbrBtnSelectStuInfo = new System.Windows.Forms.ToolBarButton();
   this.tbrBtnSeperator3 = new System.Windows.Forms.ToolBarButton();
   this.tbrBtnUpdateStuInfo = new System.Windows.Forms.ToolBarButton();
   this.tbrBtnSeperator4 = new System.Windows.Forms.ToolBarButton();
   this.tbrBtnWindowStyle = new System.Windows.Forms.ToolBarButton();
   this.contentMnu = new System.Windows.Forms.ContextMenu();
   this.menuItem1 = new System.Windows.Forms.MenuItem();
   this.menuItem2 = new System.Windows.Forms.MenuItem();
   this.menuItem3 = new System.Windows.Forms.MenuItem();
   this.imgObj = new System.Windows.Forms.ImageList(this.components);
   this.sbrObj = new System.Windows.Forms.StatusBar();
   this.sbrpnlStatus = new System.Windows.Forms.StatusBarPanel();
   this.sbrpnlTime = new System.Windows.Forms.StatusBarPanel();
   this.sbrpnlProdesigner = new System.Windows.Forms.StatusBarPanel();
   this.prgfesser = new System.Windows.Forms.ProgressBar();
   ((System.ComponentModel.ISupportInitialize)(this.sbrpnlStatus)).BeginInit();
   ((System.ComponentModel.ISupportInitialize)(this.sbrpnlTime)).BeginInit();
   ((System.ComponentModel.ISupportInitialize)(this.sbrpnlProdesigner)).BeginInit();
   this.SuspendLayout();
   //
   // toolBarObj
   //
   this.toolBarObj.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
   this.toolBarObj.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
                        this.tbrBtnAddStuInfo,
                        this.tbrBtnSperator1,
                        this.tbrBtnDelStuInfo,
                        this.tbrBtnSeperator2,
                        this.tbrBtnSelectStuInfo,
                        this.tbrBtnSeperator3,
                        this.tbrBtnUpdateStuInfo,
                        this.tbrBtnSeperator4,
                        this.tbrBtnWindowStyle});
   this.toolBarObj.DropDownArrows = true;
   this.toolBarObj.ImageList = this.imgObj;
   this.toolBarObj.Location = new System.Drawing.Point(0, 0);
   this.toolBarObj.Name = "toolBarObj";
   this.toolBarObj.ShowToolTips = true;
   this.toolBarObj.Size = new System.Drawing.Size(624, 57);
   this.toolBarObj.TabIndex = 0;
   this.toolBarObj.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBarObj_ButtonClick);
   //
   // tbrBtnAddStuInfo
   //
   this.tbrBtnAddStuInfo.ImageIndex = 0;
   this.tbrBtnAddStuInfo.Text = "添加学员信息";
   this.tbrBtnAddStuInfo.ToolTipText = "添加学员信息";
   //
   // tbrBtnSperator1
   //
   this.tbrBtnSperator1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
   //
   // tbrBtnDelStuInfo
   //
   this.tbrBtnDelStuInfo.ImageIndex = 1;
   this.tbrBtnDelStuInfo.Text = "删除学员信息";
   this.tbrBtnDelStuInfo.ToolTipText = "删除学员信息";
   //
   // tbrBtnSeperator2
   //
   this.tbrBtnSeperator2.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
   //
   // tbrBtnSelectStuInfo
   //
   this.tbrBtnSelectStuInfo.ImageIndex = 2;
   this.tbrBtnSelectStuInfo.Text = "查询学员信息";
   this.tbrBtnSelectStuInfo.ToolTipText = "查询学员信息";
   //
   // tbrBtnSeperator3
   //
   this.tbrBtnSeperator3.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
   //
   // tbrBtnUpdateStuInfo
   //
   this.tbrBtnUpdateStuInfo.ImageIndex = 3;
   this.tbrBtnUpdateStuInfo.Text = "更新学员信息";
   this.tbrBtnUpdateStuInfo.ToolTipText = "更新学员信息";
   //
   // tbrBtnSeperator4
   //
   this.tbrBtnSeperator4.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
   //
   // tbrBtnWindowStyle
   //
   this.tbrBtnWindowStyle.DropDownMenu = this.contentMnu;
   this.tbrBtnWindowStyle.ImageIndex = 7;
   this.tbrBtnWindowStyle.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton;
   this.tbrBtnWindowStyle.Text = "窗口样式";
   //
   // contentMnu
   //
   this.contentMnu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                        this.menuItem1,
                        this.menuItem2,
                        this.menuItem3});
   //
   // menuItem1
   //
   this.menuItem1.Index = 0;
   this.menuItem1.Text = "层叠(&C)";
   this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
   //
   // menuItem2
   //
   this.menuItem2.Index = 1;
   this.menuItem2.Text = "水平平铺(&H)";
   this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
   //
   // menuItem3
   //
   this.menuItem3.Index = 2;
   this.menuItem3.Text = "垂直平铺(&V)";
   this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
   //
   // imgObj
   //
   this.imgObj.ImageSize = new System.Drawing.Size(32, 32);
   this.imgObj.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imgObj.ImageStream")));
   this.imgObj.TransparentColor = System.Drawing.Color.Transparent;
   //
   // sbrObj
   //
   this.sbrObj.Location = new System.Drawing.Point(0, 376);
   this.sbrObj.Name = "sbrObj";
   this.sbrObj.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
                       this.sbrpnlStatus,
                       this.sbrpnlTime,
                       this.sbrpnlProdesigner});
   this.sbrObj.ShowPanels = true;
   this.sbrObj.Size = new System.Drawing.Size(624, 32);
   this.sbrObj.TabIndex = 2;
   //
   // sbrpnlStatus
   //
   this.sbrpnlStatus.Text = "状态: 就绪";
   this.sbrpnlStatus.Width = 200;
   //
   // sbrpnlTime
   //
   this.sbrpnlTime.Width = 400;
   //
   // sbrpnlProdesigner
   //
   this.sbrpnlProdesigner.Text = "程序设计:  Robinn@163.com";
   this.sbrpnlProdesigner.Width = 500;
   //
   // prgfesser
   //
   this.prgfesser.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
   this.prgfesser.Location = new System.Drawing.Point(440, 384);
   this.prgfesser.Minimum = 1;
   this.prgfesser.Name = "prgfesser";
   this.prgfesser.Size = new System.Drawing.Size(176, 16);
   this.prgfesser.Step = 1;
   this.prgfesser.TabIndex = 4;
   this.prgfesser.Value = 1;
   this.prgfesser.Visible = false;
   this.prgfesser.Click += new System.EventHandler(this.prgfesser_Click);
   //
   // FormMain
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
   this.ClientSize = new System.Drawing.Size(624, 408);
   this.Controls.Add(this.prgfesser);
   this.Controls.Add(this.sbrObj);
   this.Controls.Add(this.toolBarObj);
   this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
   this.IsMdiContainer = true;
   this.Name = "FormMain";
   this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
   this.Text = "学生信息管理";
   this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
   this.Load += new System.EventHandler(this.FormMain_Load);
   ((System.ComponentModel.ISupportInitialize)(this.sbrpnlStatus)).EndInit();
   ((System.ComponentModel.ISupportInitialize)(this.sbrpnlTime)).EndInit();
   ((System.ComponentModel.ISupportInitialize)(this.sbrpnlProdesigner)).EndInit();
   this.ResumeLayout(false);

  }
  #endregion

  /// <summary>
  /// 应用程序的主入口点。
  /// </summary>
  [STAThread]
  static void Main()
  {
   Application.Run(new FormMain());
  }

  public StatusBarPanel Status
  {
   get{return this.sbrpnlStatus;}
   set{this.sbrpnlStatus = value;}
  }

  public ProgressBar Probar
  {
   get{return this.prgfesser;}
   set{this.prgfesser = value;}
  }

  //初始化信息
  private void FormMain_Load(object sender, System.EventArgs e)
  {
   this.sbrpnlTime.Text = "目期:"+Convert.ToString(DateTime.Today.ToLongDateString())+"  "+Convert.ToString(DateTime.Today.DayOfWeek);
   
  }


  //选择工具时触发
  private void toolBarObj_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
  {
   if(e.Button.Text == this.toolBarObj.Buttons[0].Text)
   {
    AddStuinfo asForm = new AddStuinfo(); 
    asForm.MdiParent = this;    
    asForm.Show();
    this.sbrpnlStatus.Text = "状态: 添加学员信息";
   }
   else if(e.Button.Text == this.toolBarObj.Buttons[2].Text)
   {
    //删除子窗体的表数据
    Form[] forms = this.MdiChildren;

    for(int i=0;i<forms.Length;i++)
    {
     if(forms[i].Text.Equals("查询学员信息"))
     {
      SelStuinfo form = ((SelStuinfo)forms[i]);
      form.btnDelStuinfo_Click(sender,e);
      form.Update();
      form.Refresh();
      return;

     }
    }
   }
   else if(e.Button.Text == this.toolBarObj.Buttons[4].Text)
   {
    SelStuinfo ssForm = new SelStuinfo();
    ssForm.MdiParent = this;
    ssForm.WindowState = FormWindowState.Normal;
    ssForm.Show();
    this.sbrpnlStatus.Text = "状态: 查询学员信息"; 
   }
   else if(e.Button.Text == this.toolBarObj.Buttons[6].Text)
   {
    //更新子窗体的表数据
    Form[] forms = this.MdiChildren;

    for(int i=0;i<forms.Length;i++)
    {
     if(forms[i].Text.Equals("查询学员信息"))
     {
      SelStuinfo form = ((SelStuinfo)forms[i]);
      form.btnUpdateStuinfo_Click(sender,e);
      form.Update();
      form.Refresh();
      return;

     }
    }   
   }
  }


  //层叠
  private void menuItem1_Click(object sender, System.EventArgs e)
  {
   this.LayoutMdi(MdiLayout.Cascade);
  }


  //水平平铺
  private void menuItem2_Click(object sender, System.EventArgs e)
  {
   this.LayoutMdi(MdiLayout.TileHorizontal);
  }


  //垂直平铺
  private void menuItem3_Click(object sender, System.EventArgs e)
  {
   this.LayoutMdi(MdiLayout.TileVertical);
  }

  private void prgfesser_Click(object sender, System.EventArgs e)
  {
  
  }

  
 }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值