📄 chakan.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Text;
using System.IO;
namespace ShInfo
{
/// <summary>
/// Chakan 的摘要说明。
/// </summary>
public class Chakan : System.Windows.Forms.Form
{
private System.Windows.Forms.ListBox lstCha;
private System.Windows.Forms.Button btnShanchu;
private System.Windows.Forms.Button btnClose3;
private Sunisoft.IrisSkin.SkinEngine skinEngine1;
private System.ComponentModel.IContainer components;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Timer timer2;
private ArrayList AL;
public Chakan(ArrayList al)
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
this.skinEngine1.SkinFile = "CalmnessColor2.ssk";
AL=al;
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
ArrayList a1=new ArrayList();
/// <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(Chakan));
this.skinEngine1 = new Sunisoft.IrisSkin.SkinEngine(((System.ComponentModel.Component)(this)));
this.lstCha = new System.Windows.Forms.ListBox();
this.btnShanchu = new System.Windows.Forms.Button();
this.btnClose3 = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.timer2 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// skinEngine1
//
this.skinEngine1.SerialNumber = "";
this.skinEngine1.SkinFile = null;
//
// lstCha
//
this.lstCha.Font = new System.Drawing.Font("华文新魏", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.lstCha.ForeColor = System.Drawing.Color.Red;
this.lstCha.ItemHeight = 17;
this.lstCha.Location = new System.Drawing.Point(0, 0);
this.lstCha.Name = "lstCha";
this.lstCha.Size = new System.Drawing.Size(424, 276);
this.lstCha.TabIndex = 0;
//
// btnShanchu
//
this.btnShanchu.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btnShanchu.Location = new System.Drawing.Point(104, 296);
this.btnShanchu.Name = "btnShanchu";
this.btnShanchu.TabIndex = 1;
this.btnShanchu.Text = "删除";
this.btnShanchu.Click += new System.EventHandler(this.btnShanchu_Click);
//
// btnClose3
//
this.btnClose3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btnClose3.Location = new System.Drawing.Point(240, 296);
this.btnClose3.Name = "btnClose3";
this.btnClose3.TabIndex = 2;
this.btnClose3.Text = "关闭";
this.btnClose3.Click += new System.EventHandler(this.btnClose3_Click);
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 1;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// timer2
//
this.timer2.Interval = 1;
this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
//
// Chakan
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(424, 333);
this.Controls.Add(this.btnClose3);
this.Controls.Add(this.btnShanchu);
this.Controls.Add(this.lstCha);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Chakan";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "通讯录";
this.Load += new System.EventHandler(this.Chakan_Load);
this.ResumeLayout(false);
}
#endregion
private void btnClose3_Click(object sender, System.EventArgs e)
{
timer2.Enabled=true;
}
private void Chakan_Load(object sender, System.EventArgs e)
{
Point pp=new Point(0,335);
DesktopLocation=pp;
this.lstCha.Items.Add("姓名 "+"手机号码");
this.lstCha.Items.Add("〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓");
//// this.lstCha.Items.Add("");
Managerbookrecord w=new Managerbookrecord();
a1=w.All();
for(int i=0;i<a1.Count;i++)
{
this.lstCha.Items.Add(a1[i]);
}
}
private void btnShanchu_Click(object sender, System.EventArgs e)
{
if(this.lstCha.SelectedItem!=null)
{
a1.Remove(this.lstCha.SelectedItem);
File.Delete("通讯录.txt");
FileStream fs=null;
StreamWriter sw=null;
fs=new FileStream("通讯录.txt",FileMode.Create);
sw=new StreamWriter(fs);
if(a1!=null)
{
foreach(string a in a1)
{
sw.WriteLine(a);
}
}
sw.Close();
fs.Close();
this.lstCha.Items.Remove(this.lstCha.Text);
MessageBox.Show("删除成功","提示:");
}
else
{
MessageBox.Show("请选中一个联系人","提示:");
}
}
private void timer1_Tick(object sender, System.EventArgs e)
{
Point p=new Point(this.DesktopLocation.X+2,this.DesktopLocation.Y);
this.DesktopLocation=p;
if(p.X==436)
{
timer1.Enabled = false ;
timer1.Stop();
}
}
private void timer2_Tick(object sender, System.EventArgs e)
{
Point p = new Point ( this.DesktopLocation.X+2 , this.DesktopLocation.Y+2 ) ;
this.DesktopLocation = p ;
if(p.Y==1024)
{
this.timer2.Stop();
this.Close();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -