1C#简单通讯录文档格式.docx
- 文档编号:22871491
- 上传时间:2023-02-05
- 格式:DOCX
- 页数:53
- 大小:584.66KB
1C#简单通讯录文档格式.docx
《1C#简单通讯录文档格式.docx》由会员分享,可在线阅读,更多相关《1C#简单通讯录文档格式.docx(53页珍藏版)》请在冰豆网上搜索。
图1.2.5
(3)快速查找界面设计
查找功能包括一个简单的快速搜索方法,用户输入简单的名字信息,表格会自动跳转至用户想要找到的信息上,查找功能界面如下图1.3.1所示,实现搜索功能涉及的主要代码截图如下图1.3.2另外该界面加载时系统同样会将通讯录.txt内的信息加载到表格里,所使用方法同上,在这里不再描述
图1.3.1
图1.3.2
(4)添加界面设计
添加界面的设计较为简单只包括四个供输入的文本框,四个标签,一个确定输入的按钮,如图1.4.1所示,用户输入功能要求用户输入的姓名不能为空电话必须为纯数字,对住址和性别的输入未作限制,同时系统使用字符“*&
$”作为标记分隔用户的输入方便以后的读取,实现这些功能所涉及到的代码如图1.4.2所示,图1.4.3给出用户添加一些资料后,通讯录.txt的内容情况
图1.4.1
图1.4.2
图1.4.3
二、程序运行测试结果
主界面
点击管理通讯录
选中赵一,钱二两项点击删除后
选中123124123141项点击修改,在显示出的修改框内修改该记录为张宇飞男312313124
点击确认修改
如果输入的电话号码不是纯数字
未作保存,直接点右上角退出通讯录
保存后点击关闭按钮系统会返回主界面
点击快速查找按钮
输入“武”进行搜索
输入“白”进行搜索
关闭搜索界面,在主界面点击添加联系人按钮
当输入姓名为空时
当输入电话不为纯数字时
关闭添加联系人界面,返回主界面点击退出
点击是,立刻退出简单通讯录系统
三、程序源代码
---------program.cs------------------------------------------------------------------------------------------------
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Windows.Forms;
namespaceWindowsFormsApplication3
{
staticclassProgram
{
///<
summary>
///应用程序的主入口点。
/summary>
[STAThread]
staticvoidMain()
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new简单通讯录());
}
}
------------------简单通讯录.Designer.cs--------------------------------
partialclass简单通讯录
///必需的设计器变量。
privateSystem.ComponentModel.IContainercomponents=null;
///清理所有正在使用的资源。
paramname="
disposing"
>
如果应释放托管资源,为true;
否则为false。
<
/param>
protectedoverridevoidDispose(booldisposing)
if(disposing&
&
(components!
=null))
components.Dispose();
base.Dispose(disposing);
#regionWindows窗体设计器生成的代码
///设计器支持所需的方法-不要
///使用代码编辑器修改此方法的内容。
privatevoidInitializeComponent()
this.flowLayoutPanel1=newSystem.Windows.Forms.FlowLayoutPanel();
this.button2=newSystem.Windows.Forms.Button();
this.button3=newSystem.Windows.Forms.Button();
this.button1=newSystem.Windows.Forms.Button();
this.button4=newSystem.Windows.Forms.Button();
this.flowLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
//flowLayoutPanel1
this.flowLayoutPanel1.Controls.Add(this.button2);
this.flowLayoutPanel1.Controls.Add(this.button3);
this.flowLayoutPanel1.Controls.Add(this.button1);
this.flowLayoutPanel1.Controls.Add(this.button4);
this.flowLayoutPanel1.Location=newSystem.Drawing.Point(74,23);
this.flowLayoutPanel1.Name="
flowLayoutPanel1"
;
this.flowLayoutPanel1.Size=newSystem.Drawing.Size(133,130);
this.flowLayoutPanel1.TabIndex=0;
//button2
this.button2.Location=newSystem.Drawing.Point(3,3);
this.button2.Name="
button2"
this.button2.Size=newSystem.Drawing.Size(129,25);
this.button2.TabIndex=1;
this.button2.Text="
管理通信录"
this.button2.UseVisualStyleBackColor=true;
this.button2.Click+=newSystem.EventHandler(this.button2_Click);
//button3
this.button3.Location=newSystem.Drawing.Point(3,34);
this.button3.Name="
button3"
this.button3.Size=newSystem.Drawing.Size(129,25);
this.button3.TabIndex=2;
this.button3.Text="
快速查找"
this.button3.UseVisualStyleBackColor=true;
this.button3.Click+=newSystem.EventHandler(this.button3_Click);
//button1
this.button1.Location=newSystem.Drawing.Point(3,65);
this.button1.Name="
button1"
this.button1.Size=newSystem.Drawing.Size(129,25);
this.button1.TabIndex=0;
this.button1.Text="
添加联系人"
this.button1.UseVisualStyleBackColor=true;
this.button1.Click+=newSystem.EventHandler(this.button1_Click);
//button4
this.button4.Location=newSystem.Drawing.Point(3,96);
this.button4.Name="
button4"
this.button4.Size=newSystem.Drawing.Size(129,25);
this.button4.TabIndex=3;
this.button4.Text="
退出"
this.button4.UseVisualStyleBackColor=true;
this.button4.Click+=newSystem.EventHandler(this.button4_Click);
//简单通讯录
this.AutoScaleDimensions=newSystem.Drawing.SizeF(6F,12F);
this.AutoScaleMode=System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize=newSystem.Drawing.Size(284,262);
this.Controls.Add(this.flowLayoutPanel1);
this.Name="
简单通讯录"
this.Text="
this.flowLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false);
#endregion
privateSystem.Windows.Forms.FlowLayoutPanelflowLayoutPanel1;
privateSystem.Windows.Forms.Buttonbutton1;
privateSystem.Windows.Forms.Buttonbutton2;
privateSystem.Windows.Forms.Buttonbutton3;
privateSystem.Windows.Forms.Buttonbutton4;
------------------------------简单通讯录.cs---------------------------
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.IO;
publicpartialclass简单通讯录:
Form
public简单通讯录()
InitializeComponent();
privatevoidbutton4_Click(objectsender,EventArgse)
{//点击退出按钮系统提示是否退出通讯录系统
DialogResultdiares;
MessageBoxButtonsbuttons=MessageBoxButtons.YesNo;
MessageBoxDefaultButtondefbut=MessageBoxDefaultButton.Button1;
MessageBoxIconicon=MessageBoxIcon.Question;
stringask="
你是否要退出通讯录?
"
stringcaption="
@温馨提示@"
diares=MessageBox.Show(this,ask,caption,buttons,icon,defbut);
if(diares==DialogResult.Yes)
this.Close();
privatevoidbutton1_Click(objectsender,EventArgse)
new添加联系人().Show();
privatevoidbutton2_Click(objectsender,EventArgse)
newManageForm().Show();
privatevoidbutton3_Click(objectsender,EventArgse)
new快速查找().Show();
------------------------管理通讯录.Designer.cs---------------------------------
partialclassManageForm
///Requireddesignervariable.
///Cleanupanyresourcesbeingused.
trueifmanagedresourcesshouldbedisposed;
otherwise,false.<
#regionWindowsFormDesignergeneratedcode
///RequiredmethodforDesignersupport-donotmodify
///thecontentsofthismethodwiththecodeeditor.
this.listView1=newSystem.Windows.Forms.ListView();
this.column1=((System.Windows.Forms.ColumnHeader)(newSystem.Windows.Forms.ColumnHeader()));
this.column2=((System.Windows.Forms.ColumnHeader)(newSystem.Windows.Forms.ColumnHeader()));
this.column3=((System.Windows.Forms.ColumnHeader)(newSystem.Windows.Forms.ColumnHeader()));
this.column4=((System.Windows.Forms.ColumnHeader)(newSystem.Windows.Forms.ColumnHeader()));
this.deletebutton=newSystem.Windows.Forms.Button();
this.alterbutton=newSystem.Windows.Forms.Button();
this.savebutton=newSystem.Windows.Forms.Button();
this.panel1=newSystem.Windows.Forms.Panel();
this.textbox3=newSystem.Windows.Forms.TextBox();
this.label4=newSystem.Windows.Forms.Label();
this.textbox4=newSystem.Windows.Forms.TextBox();
this.label3=newSystem.Windows.Forms.Label();
this.textbox2=newSystem.Windows.Forms.TextBox();
this.label2=newSystem.Windows.Forms.Label();
this.label1=newSystem.Windows.Forms.Label();
this.textbox1=newSystem.Windows.Forms.TextBox();
this.panel1.SuspendLayout();
//listView1
this.listView1.BackColor=System.Drawing.SystemColors.ScrollBar;
this.listView1.Columns.AddRange(newSystem.Windows.Forms.ColumnHeader[]{
this.column1,
this.column2,
this.column3,
this.column4});
this.listView1.ForeColor=System.Drawing.SystemColors.InfoText;
this.listView1.FullRowSelect=true;
this.listView1.GridLines=true;
this.listView1.Location=newSystem.Drawing.Point(12,12);
this.listView1.Name="
listView1"
this.listView1.Size=newSystem.Drawing.Size(327,238);
this.listView1.TabIndex=0;
this.listView1.UseCompatibleStateImageBehavior=false;
this.listView1.View=System.Windows.Forms.View.Details;
//column1
this.column1.Text="
姓名"
//column2
this.column2.Text="
性别"
//column3
this.column3.Text="
电话"
this.column3.Width=90;
//column4
this.column4.Text="
住址"
this.column4.Width=120;
//deletebutton
this.deletebutton.Location=newSystem.Drawing.Point(345,43);
this.deletebutton.Name="
deletebutton"
this.deletebutton.Size=newSystem.Drawing.Size(75,23);
this.deletebutton.TabIndex=1;
this.deletebutton.Text="
删除"
this.deletebutton.UseVisualStyleBackColor=true;
this.deletebutton.Click+=newSystem.EventHand
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- C# 简单 通讯录