欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Winform學(xué)生信息管理系統(tǒng)各子窗體剖析(3)

 更新時(shí)間:2016年05月30日 16:24:28   作者:丿木呈廣予口貝  
這篇文章主要針對Winform學(xué)生信息管理系統(tǒng)各子窗體進(jìn)行剖析,感興趣的小伙伴們可以參考一下

先來補(bǔ)充一下學(xué)生信息管理系統(tǒng)登錄窗體,在完成的過程中總是遇到各種各樣的問題,對于登錄窗體的設(shè)計(jì)還是存在著一些弊端,那就是需要登錄學(xué)生信息管理系統(tǒng)時(shí)如果輸入的數(shù)據(jù)出錯(cuò)不必一個(gè)個(gè)刪除,就需要在窗體上再添加一個(gè)清空寫入數(shù)據(jù)的button控件,將其屬性Text改為重置。還有一個(gè)與登錄窗口設(shè)計(jì)的屬性AcceptButton將其改為確定按鈕的唯一名字(也就是button1),因此在按下回車鍵后我們也能登錄到學(xué)生信息管理系統(tǒng)主頁面相對應(yīng)的CancelButton將其改為取消按鈕的唯一名字(也就是button2),因此在按下退出鍵后也能退出登錄窗口。
需要在重置的button按鈕控件添加的Click事件的代碼為:

<span style="font-size:18px;">private void button3_Click(object sender, EventArgs e) 
{ 
 textBox1.Text = ""; 
 textBox2.Text = ""; 
}</span> 

完成改動后的登錄窗口為:

 下面就來設(shè)計(jì)一些需要都用到的子窗體。

一、學(xué)生信息添加窗體

        學(xué)生信息添加窗體窗體主要是用來添加學(xué)生信息或者修改學(xué)生信息,輸入學(xué)號、姓名、性別、出生日期、家庭住址、家庭電話和所在班級,點(diǎn)擊“保存”按鈕即可錄入或者修改學(xué)生信息記錄,點(diǎn)擊“取消”按鈕,退出學(xué)生信息添加窗體。這個(gè)窗體需要用到的控件有Label控件,TextBox控件,Button控件,Panel控件和ComboBox控件。在學(xué)生信息管理系統(tǒng)主頁面中的菜單選項(xiàng)中找到學(xué)生管理,再次單擊學(xué)生信息就會出現(xiàn)學(xué)生信息添加的窗口。

 二、用戶信息添加窗體

         用戶信息添加窗體主要是實(shí)現(xiàn)登錄用戶的添加操作。該窗體中包含了用戶名、密碼、確認(rèn)密碼和用戶權(quán)限這些信息。當(dāng)點(diǎn)擊“保存”按鈕時(shí),即可以將用戶的這些信息添加到數(shù)據(jù)庫中。點(diǎn)擊“取消”按鈕,可以退出用戶信息添加窗體。這個(gè)窗體需要用到的控件有Label控件,TextBox控件,Button控件,Panel控件和ComboBox控件。在學(xué)生信息管理系統(tǒng)主頁面中的菜單選項(xiàng)中找到系統(tǒng)管理,再次單擊用戶信息就會出現(xiàn)用戶信息添加的窗口。

 三、用戶修改密碼窗體

        用戶修改密碼窗體主要是實(shí)現(xiàn)用戶修改密碼的功能。該窗體中,可以通過輸入用戶名和原密碼,然后輸入新密碼和確認(rèn)新密碼,來修改用戶的登錄密碼。這個(gè)窗體需要用到的控件有Label控件,TextBox控件,Button控件,Panel控件。在學(xué)生信息管理系統(tǒng)主頁面中的菜單選項(xiàng)中找到系統(tǒng)管理,再次單擊用戶修改密碼就會出現(xiàn)用戶修改密碼添加的窗口。

上述三個(gè)子窗體中的取消按鈕都是一樣的代碼寫入:

<span style="font-size:18px;">private void button2_Click(object sender, EventArgs e) 
{ 
  Close(); 
}</span> 

經(jīng)過上述的改動和子窗體的添加后的完整的Form1(學(xué)生信息管理系統(tǒng)登錄窗口)的代碼為:

<span style="font-size:18px;">using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using System.Windows.Forms; 
 
namespace WindowsForms 
{ 
  public partial class Form1 : Form 
  { 
    public Form1() 
    { 
      InitializeComponent(); 
    } 
 
    private void button1_Click(object sender, EventArgs e) 
    { 
      string str = textBox1.Text;//獲取你在textBox1中輸入的信息 
      Form2 ad = new Form2(str);//創(chuàng)建一個(gè)學(xué)生信息管理系統(tǒng)主界面的對象 
      ad.Show();//點(diǎn)擊確定后進(jìn)入學(xué)生信息管理系統(tǒng)主界面 
      this.Hide();//單擊確定后隱藏登錄窗口 
    } 
 
    private void button2_Click(object sender, EventArgs e) 
    { 
      Application.Exit();//點(diǎn)擊取消退出整個(gè)程序 
    } 
 
    private void button3_Click(object sender, EventArgs e) 
    { 
      textBox1.Text = "";//這是清空你寫入的用戶名稱 
      textBox2.Text = "";//這是清空你寫入的用戶密碼 
    } 
  } 
}</span></span> 

完整的Form2(學(xué)生信息管理系統(tǒng)主頁面)的代碼為:

<span style="font-size:18px;"><span style="font-size:18px;">using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using System.Windows.Forms; 
 
namespace WindowsForms 
{ 
  public partial class Form2 : Form 
  { 
    public Form2(string s) 
    { 
      InitializeComponent(); 
      tssl_name.Text = s;//將登陸窗口textBox1輸入的信息傳遞給狀態(tài)欄Text屬性 
    } 
 
    private void 退出ToolStripMenuItem_Click(object sender, EventArgs e) 
    { 
      Application.Exit();//單擊主菜單中的退出我們退出整個(gè)程序 
    } 
 
    private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) 
    { 
 
    } 
 
    private void toolStripButton1_Click(object sender, EventArgs e) 
    { 
      Children qq = new Children();//創(chuàng)建一個(gè)子窗體的實(shí)例 
      qq.MdiParent = this;//要求子窗體的父窗體是MDI窗體 
      qq.Show(); 
    } 
 
    private void 學(xué)生信息ToolStripMenuItem_Click(object sender, EventArgs e) 
    { 
      Children1 c1 = new Children1(); 
      c1.MdiParent = this; 
      c1.Show(); 
    } 
 
    private void 用戶信息ToolStripMenuItem_Click(object sender, EventArgs e) 
    { 
      Children2 c2 = new Children2(); 
      c2.MdiParent = this; 
      c2.Show(); 
    } 
 
    private void 用戶密碼修改ToolStripMenuItem_Click(object sender, EventArgs e) 
    { 
      Children3 c3 = new Children3(); 
      c3.MdiParent = this; 
      c3.Show(); 
    } 
  } 
}</span> 

完整的子窗體Children1(學(xué)生信息添加窗體)的代碼為:

<span style="font-size:18px;">using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using System.Windows.Forms; 
 
namespace WindowsForms 
{ 
  public partial class Children1 : Form 
  { 
    public Children1() 
    { 
      InitializeComponent(); 
    } 
 
    private void button2_Click(object sender, EventArgs e) 
    { 
      Close(); 
    } 
  } 
}</span> 

完整的子窗體Children2(用戶信息添加窗體)的代碼為:

<span style="font-size:18px;">using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using System.Windows.Forms; 
 
namespace WindowsForms 
{ 
  public partial class Children2 : Form 
  { 
    public Children2() 
    { 
      InitializeComponent(); 
    } 
 
    private void button2_Click(object sender, EventArgs e) 
    { 
      Close(); 
    } 
 
    private void s(object sender, EventArgs e) 
    { 
    } 
  } 
}</span> 

完整的子窗體Children2(用戶密碼修改窗體)的代碼為:

<span style="font-size:18px;">using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using System.Windows.Forms; 
 
namespace WindowsForms 
{ 
  public partial class Children3 : Form 
  { 
    public Children3() 
    { 
      InitializeComponent(); 
    } 
 
    private void button2_Click(object sender, EventArgs e) 
    { 
      Close(); 
    } 
  } 
}</span> 

在登錄學(xué)生信息管理系統(tǒng)主頁面打開子窗體的界面為:

在文件中找到你所編寫的程序,打開exe運(yùn)行學(xué)生信息管理系統(tǒng),檢驗(yàn)是否與自己設(shè)計(jì)想象的有什么不同,不同的話進(jìn)行修改調(diào)試,直到與自己預(yù)想的結(jié)果相吻合就可以了。

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助。

相關(guān)文章

最新評論