資源簡介
c#實現用戶登錄,用戶選擇登錄身份進行登錄,登陸成功后可以實現簡單記事本功能

代碼片段和文件信息
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;
using?System.IO;
namespace?_05簡單記事本兒應用程序
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????txtWords.WordWrap?=?false;
????????????btnWordWrap.Visible?=?false;
????????????btnSave.Visible?=?false;
????????????txtWords.Visible?=?false;
????????}
????????///?
????????///?判斷是否登陸成功
????????///?
????????///?
????????///?
????????private?void?btnLogin_Click(object?sender?EventArgs?e)
????????{
????????????string?name?=?txtName.Text.Trim();
????????????string?pwd?=?txtPwd.Text;
????????????if?(name?==?“admin“?&&?pwd?==?“admin“)
????????????{
????????????????MessageBox.Show(“歡迎進入記事兒本應用程序“);
????????????????btnWordWrap.Visible?=?true;
????????????????btnSave.Visible?=?true;
????????????????txtWords.Visible?=?true;
????????????????label1.Visible?=?false;
????????????????label2.Visible?=?false;
????????????????txtName.Visible?=?false;
????????????????txtPwd.Visible?=?false;
????????????????btnLogin.Visible?=?false;
????????????????btnRest.Visible?=?false;
????????????}
????????????else//登錄失敗
????????????{
????????????????MessageBox.Show(“用戶名或密碼錯誤,請重新輸入“);
????????????????txtName.Clear();
????????????????txtPwd.Clear();
????????????????//讓文本框獲得焦點
????????????????txtName.Focus();
????????????}
????????}
????????private?void?btnRest_Click(object?sender?EventArgs?e)
????????{
????????????txtName.Clear();
????????????txtPwd.Clear();
????????????txtName.Focus();
????????}
????????///?
????????///?自動換行
????????///?
????????///?
????????///?
????????private?void?btnWordWrap_Click(object?sender?EventArgs?e)
????????{
????????????//當前是否是自動換行
????????????//txtWords.WordWrap=true;
????????????//取消自動換行??
????????????if?(btnWordWrap.Text?==?“自動換行“)
????????????{
????????????????//取消自動換行
????????????????txtWords.WordWrap?=?true;
????????????????btnWordWrap.Text?=?“取消自動換行“;
????????????}
????????????else?if?(btnWordWrap.Text?==?“取消自動換行“)
????????????{
????????????????txtWords.WordWrap?=?false;
????????????????btnWordWrap.Text?=?“自動換行“;
????????????}
????????}
????????///?
????????///?保存
????????///?
????????///?
????????///?
????????private?void?btnSave_Click(object?sender?EventArgs?e)
????????{
????????????using?(FileStream?fsWrite?=?new?FileStream(@“D:\queena.pan\桌面\new.txt“?FileMode.OpenOrCreate?FileAccess.Write))
????????????{
????????????????//移除字首或字尾的空白
????????????????string?s
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????5632??2017-12-22?19:57??05簡單記事本兒應用程序\.vs\05簡單記事本兒應用程序\v14\.suo
?????文件???????3845??2014-05-23?15:42??05簡單記事本兒應用程序\05簡單記事本兒應用程序.csproj
?????文件????????187??2014-05-23?15:38??05簡單記事本兒應用程序\App.config
?????文件??????11264??2017-12-22?10:22??05簡單記事本兒應用程序\bin\Debug\05簡單記事本兒應用程序.exe
?????文件????????187??2014-05-23?15:38??05簡單記事本兒應用程序\bin\Debug\05簡單記事本兒應用程序.exe.config
?????文件??????32256??2017-12-22?10:22??05簡單記事本兒應用程序\bin\Debug\05簡單記事本兒應用程序.pdb
?????文件??????22696??2017-12-22?10:42??05簡單記事本兒應用程序\bin\Debug\05簡單記事本兒應用程序.vshost.exe
?????文件????????187??2014-05-23?15:38??05簡單記事本兒應用程序\bin\Debug\05簡單記事本兒應用程序.vshost.exe.config
?????文件????????490??2013-03-18?17:00??05簡單記事本兒應用程序\bin\Debug\05簡單記事本兒應用程序.vshost.exe.manifest
?????文件???????3478??2017-12-22?10:22??05簡單記事本兒應用程序\Form1.cs
?????文件???????6566??2014-05-23?15:57??05簡單記事本兒應用程序\Form1.Designer.cs
?????文件???????5817??2014-05-23?15:57??05簡單記事本兒應用程序\Form1.resx
?????文件???????2907??2017-12-22?10:42??05簡單記事本兒應用程序\obj\Debug\05簡單記事本兒應用程序.csproj.FileListAbsolute.txt
?????文件????????977??2014-05-23?15:58??05簡單記事本兒應用程序\obj\Debug\05簡單記事本兒應用程序.csproj.GenerateResource.Cache
?????文件???????2211??2017-12-22?10:06??05簡單記事本兒應用程序\obj\Debug\05簡單記事本兒應用程序.csprojResolveAssemblyReference.cache
?????文件??????11264??2017-12-22?10:22??05簡單記事本兒應用程序\obj\Debug\05簡單記事本兒應用程序.exe
?????文件??????32256??2017-12-22?10:22??05簡單記事本兒應用程序\obj\Debug\05簡單記事本兒應用程序.pdb
?????文件????????864??2017-12-22?10:42??05簡單記事本兒應用程序\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????7019??2017-12-22?10:42??05簡單記事本兒應用程序\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件??????????0??2014-05-23?15:38??05簡單記事本兒應用程序\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
?????文件??????????0??2014-05-23?15:38??05簡單記事本兒應用程序\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
?????文件??????????0??2014-05-23?15:38??05簡單記事本兒應用程序\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
?????文件????????180??2014-05-23?15:58??05簡單記事本兒應用程序\obj\Debug\_05簡單記事本兒應用程序.Form1.resources
?????文件????????180??2014-05-23?15:42??05簡單記事本兒應用程序\obj\Debug\_05簡單記事本兒應用程序.Properties.Resources.resources
?????文件????????545??2014-05-23?15:38??05簡單記事本兒應用程序\Program.cs
?????文件???????1388??2014-05-23?15:38??05簡單記事本兒應用程序\Properties\AssemblyInfo.cs
?????文件???????2918??2014-05-23?15:38??05簡單記事本兒應用程序\Properties\Resources.Designer.cs
?????文件???????5612??2014-05-23?15:38??05簡單記事本兒應用程序\Properties\Resources.resx
?????文件???????1120??2014-05-23?15:38??05簡單記事本兒應用程序\Properties\Settings.Designer.cs
?????文件????????249??2014-05-23?15:38??05簡單記事本兒應用程序\Properties\Settings.settings
............此處省略14個文件信息
- 上一篇:c# 招聘系統代碼,初學者可看
- 下一篇:c# 非常漂亮的登錄窗體
評論
共有 條評論