Winform先生信息治理體系各子窗體分析(3)。本站提示廣大學習愛好者:(Winform先生信息治理體系各子窗體分析(3))文章只能為提供參考,不一定能成為您想要的結果。以下是Winform先生信息治理體系各子窗體分析(3)正文
先來彌補一下先生信息治理體系登錄窗體,在完成的進程中老是碰到各類各樣的成績,關於登錄窗體的設計照樣存在著一些弊病,那就是須要登錄先生信息治理體系時假如輸出的數據失足不用一個個刪除,就須要在窗體上再添加一個清空寫入數據的button控件,將其屬性Text改成重置。還有一個與登錄窗口設計的屬性AcceptButton將其改成肯定按鈕的獨一名字(也就是button1),是以在按下回車鍵後我們也能登錄到先生信息治理體系主頁面絕對應的CancelButton將其改成撤消按鈕的獨一名字(也就是button2),是以在按下加入鍵後也能加入登錄窗口。
須要在重置的button按鈕控件添加的Click事宜的代碼為:
<span >private void button3_Click(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
}</span>
完成修改後的登錄窗口為:

上面就來設計一些須要都用到的子窗體。
1、先生信息添加窗體
先生信息添加窗體窗體重要是用來添加先生信息或許修正先生信息,輸出學號、姓名、性別、出身日期、家庭住址、家庭德律風和地點班級,點擊“保留”按鈕便可錄入或許修正先生信息記載,點擊“撤消”按鈕,加入先生信息添加窗體。這個窗體須要用到的控件有Label控件,TextBox控件,Button控件,Panel控件和ComboBox控件。在先生信息治理體系主頁面中的菜單選項中找到先生治理,再次單擊先生信息就會湧現先生信息添加的窗口。

2、用戶信息添加窗體
用戶信息添加窗體重要是完成登錄用戶的添加操作。該窗體中包括了用戶名、暗碼、確認暗碼和用戶權限這些信息。當點擊“保留”按鈕時,便可以將用戶的這些信息添加到數據庫中。點擊“撤消”按鈕,可以加入用戶信息添加窗體。這個窗體須要用到的控件有Label控件,TextBox控件,Button控件,Panel控件和ComboBox控件。在先生信息治理體系主頁面中的菜單選項中找到體系治理,再次單擊用戶信息就會湧現用戶信息添加的窗口。

3、用戶修正暗碼窗體
用戶修正暗碼窗體重要是完成用戶修正暗碼的功效。該窗體中,可以經由過程輸出用戶名和原暗碼,然後輸出新暗碼和確認新暗碼,來修正用戶的登錄暗碼。這個窗體須要用到的控件有Label控件,TextBox控件,Button控件,Panel控件。在先生信息治理體系主頁面中的菜單選項中找到體系治理,再次單擊用戶修正暗碼就會湧現用戶修正暗碼添加的窗口。

上述三個子窗體中的撤消按鈕都是一樣的代碼寫入:
<span >private void button2_Click(object sender, EventArgs e)
{
Close();
}</span>
經由上述的修改和子窗體的添加後的完全的Form1(先生信息治理體系登錄窗口)的代碼為:
<span >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);//創立一個先生信息治理體系主界面的對象
ad.Show();//點擊肯定落後退學生信息治理體系主界面
this.Hide();//單擊肯定後隱蔽登錄窗口
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();//點擊撤消加入全部法式
}
private void button3_Click(object sender, EventArgs e)
{
textBox1.Text = "";//這是清空你寫入的用戶稱號
textBox2.Text = "";//這是清空你寫入的用戶暗碼
}
}
}</span></span>
完全的Form2(先生信息治理體系主頁面)的代碼為:
<span ><span >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輸出的信息傳遞給狀況欄Text屬性
}
private void 加入ToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();//單擊主菜單中的加入我們加入全部法式
}
private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
Children qq = new Children();//創立一個子窗體的實例
qq.MdiParent = this;//請求子窗體的父窗體是MDI窗體
qq.Show();
}
private void 先生信息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(先生信息添加窗體)的代碼為:
<span >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 >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 >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>
在登錄先生信息治理體系主頁面翻開子窗體的界面為:

在文件中找到你所編寫的法式,翻開exe運轉先生信息治理體系,磨練能否與本身設計想象的有甚麼分歧,分歧的話停止修正調試,直到與本身料想的成果相吻合便可以了。
以上就是本文的全體內容,願望對年夜家的進修有所贊助。