📄 yifaduanxin.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;
namespace ShInfo
{
/// <summary>
/// Yifaduanxin 的摘要说明。
/// </summary>
public class Yifaduanxin : System.Windows.Forms.Form
{
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Button btnqingchu;
private System.Windows.Forms.Button btnguanbi;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Yifaduanxin()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <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()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Yifaduanxin));
this.listBox1 = new System.Windows.Forms.ListBox();
this.btnqingchu = new System.Windows.Forms.Button();
this.btnguanbi = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// listBox1
//
this.listBox1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.listBox1.ForeColor = System.Drawing.Color.Red;
this.listBox1.ItemHeight = 14;
this.listBox1.Location = new System.Drawing.Point(0, 0);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(472, 242);
this.listBox1.TabIndex = 0;
//
// btnqingchu
//
this.btnqingchu.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btnqingchu.Location = new System.Drawing.Point(128, 256);
this.btnqingchu.Name = "btnqingchu";
this.btnqingchu.TabIndex = 2;
this.btnqingchu.Text = "清除(&C)";
this.btnqingchu.Click += new System.EventHandler(this.btnqingchu_Click);
//
// btnguanbi
//
this.btnguanbi.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btnguanbi.Location = new System.Drawing.Point(264, 256);
this.btnguanbi.Name = "btnguanbi";
this.btnguanbi.TabIndex = 3;
this.btnguanbi.Text = "关闭(&E)";
this.btnguanbi.Click += new System.EventHandler(this.btnguanbi_Click);
//
// Yifaduanxin
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(472, 301);
this.Controls.Add(this.btnguanbi);
this.Controls.Add(this.btnqingchu);
this.Controls.Add(this.listBox1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "Yifaduanxin";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "已发短信";
this.Load += new System.EventHandler(this.Yifaduanxin_Load);
this.ResumeLayout(false);
}
#endregion
private void btnguanbi_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void Yifaduanxin_Load(object sender, System.EventArgs e)
{
ArrayList al=new ArrayList();
Sendmessagebox w=new Sendmessagebox();
al=w.Readinfo();
for(int i=0;i<al.Count;i++)
{
this.listBox1.Items.Add(al[i]);
}
}
private void btnqingchu_Click(object sender, System.EventArgs e)
{
ArrayList a2=new ArrayList();
if(this.listBox1.SelectedItem!=null)
{
a2.Remove(this.listBox1.SelectedItem);
File.Delete("发信箱.txt");
FileStream fs=null;
StreamWriter sw=null;
fs=new FileStream("发信箱.txt",FileMode.Create);
sw=new StreamWriter(fs);
if(a2!=null)
{
foreach(string a in a2)
{
sw.WriteLine(a);
}
}
sw.Close();
fs.Close();
this.listBox1.Items.Remove(this.listBox1.Text);
MessageBox.Show("清除成功","提示:");
}
else
{
MessageBox.Show("请选中一个联系人","提示:");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -