📄 form1.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
namespace WindowsApplication1
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox MobPort;
private System.Windows.Forms.Label State_Show;
private System.Windows.Forms.Button Sms_Connection_Button;
private System.Windows.Forms.Button Sms_Disconnection_Button;
private System.Windows.Forms.TextBox SendSms_Text;
private System.Windows.Forms.TextBox TelNum_Text;
private System.Windows.Forms.Button Sms_Send_Button;
private System.Windows.Forms.Label NewSms_Show;
private System.Windows.Forms.Button Sms_Start_Button;
private System.Windows.Forms.Button Sms_Close_Button;
private System.Windows.Forms.TextBox ReceiveSms_Text;
private System.Windows.Forms.Button Sms_Receive_Button;
private System.Windows.Forms.TextBox DeleteSms_Index;
private System.Windows.Forms.Button Sms_Delete_Button;
private System.Windows.Forms.Button Sms_Exit_Button;
private System.Windows.Forms.Timer NewSms_Timer;
private System.ComponentModel.IContainer components;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.label1 = new System.Windows.Forms.Label();
this.MobPort = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.Sms_Disconnection_Button = new System.Windows.Forms.Button();
this.Sms_Connection_Button = new System.Windows.Forms.Button();
this.State_Show = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.Sms_Send_Button = new System.Windows.Forms.Button();
this.label6 = new System.Windows.Forms.Label();
this.TelNum_Text = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.SendSms_Text = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.Sms_Close_Button = new System.Windows.Forms.Button();
this.Sms_Start_Button = new System.Windows.Forms.Button();
this.NewSms_Show = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.Sms_Receive_Button = new System.Windows.Forms.Button();
this.ReceiveSms_Text = new System.Windows.Forms.TextBox();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.Sms_Delete_Button = new System.Windows.Forms.Button();
this.DeleteSms_Index = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.Sms_Exit_Button = new System.Windows.Forms.Button();
this.NewSms_Timer = new System.Windows.Forms.Timer(this.components);
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox5.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(16, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(53, 12);
this.label1.TabIndex = 0;
this.label1.Text = "端口号:";
//
// MobPort
//
this.MobPort.Location = new System.Drawing.Point(64, 8);
this.MobPort.Name = "MobPort";
this.MobPort.Size = new System.Drawing.Size(56, 21);
this.MobPort.TabIndex = 1;
this.MobPort.Text = "5";
//
// label2
//
this.label2.Location = new System.Drawing.Point(16, 40);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(256, 16);
this.label2.TabIndex = 2;
this.label2.Text = "注:0为红外接口,1,2,3,...为串口";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.Sms_Disconnection_Button);
this.groupBox1.Controls.Add(this.Sms_Connection_Button);
this.groupBox1.Controls.Add(this.State_Show);
this.groupBox1.Location = new System.Drawing.Point(16, 56);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(256, 80);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "连接GSM MODEM";
this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter);
//
// Sms_Disconnection_Button
//
this.Sms_Disconnection_Button.Enabled = false;
this.Sms_Disconnection_Button.Location = new System.Drawing.Point(144, 48);
this.Sms_Disconnection_Button.Name = "Sms_Disconnection_Button";
this.Sms_Disconnection_Button.Size = new System.Drawing.Size(76, 24);
this.Sms_Disconnection_Button.TabIndex = 2;
this.Sms_Disconnection_Button.Text = "断开";
this.Sms_Disconnection_Button.Click += new System.EventHandler(this.Sms_Disconnection_Button_Click);
//
// Sms_Connection_Button
//
this.Sms_Connection_Button.Location = new System.Drawing.Point(36, 48);
this.Sms_Connection_Button.Name = "Sms_Connection_Button";
this.Sms_Connection_Button.Size = new System.Drawing.Size(76, 24);
this.Sms_Connection_Button.TabIndex = 1;
this.Sms_Connection_Button.Text = "连接";
this.Sms_Connection_Button.Click += new System.EventHandler(this.Sms_Connection_Button_Click);
//
// State_Show
//
this.State_Show.BackColor = System.Drawing.SystemColors.Desktop;
this.State_Show.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.State_Show.Location = new System.Drawing.Point(8, 16);
this.State_Show.Name = "State_Show";
this.State_Show.Size = new System.Drawing.Size(240, 24);
this.State_Show.TabIndex = 0;
this.State_Show.Text = "连接状态";
this.State_Show.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.Sms_Send_Button);
this.groupBox2.Controls.Add(this.label6);
this.groupBox2.Controls.Add(this.TelNum_Text);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Controls.Add(this.SendSms_Text);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Location = new System.Drawing.Point(16, 144);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(256, 232);
this.groupBox2.TabIndex = 4;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "发送短信";
//
// Sms_Send_Button
//
this.Sms_Send_Button.Location = new System.Drawing.Point(72, 200);
this.Sms_Send_Button.Name = "Sms_Send_Button";
this.Sms_Send_Button.Size = new System.Drawing.Size(112, 24);
this.Sms_Send_Button.TabIndex = 5;
this.Sms_Send_Button.Text = "发送";
this.Sms_Send_Button.Click += new System.EventHandler(this.Sms_Send_Button_Click);
//
// label6
//
this.label6.Location = new System.Drawing.Point(8, 168);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(240, 32);
this.label6.TabIndex = 4;
this.label6.Text = "注:发送内容最多70个汉字或180个英文字母, 超长时自动分段发送。";
//
// TelNum_Text
//
this.TelNum_Text.Location = new System.Drawing.Point(8, 136);
this.TelNum_Text.Name = "TelNum_Text";
this.TelNum_Text.Size = new System.Drawing.Size(240, 21);
this.TelNum_Text.TabIndex = 3;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(8, 120);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(65, 12);
this.label5.TabIndex = 2;
this.label5.Text = "手机号码:";
//
// SendSms_Text
//
this.SendSms_Text.Location = new System.Drawing.Point(8, 40);
this.SendSms_Text.Multiline = true;
this.SendSms_Text.Name = "SendSms_Text";
this.SendSms_Text.Size = new System.Drawing.Size(240, 72);
this.SendSms_Text.TabIndex = 1;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(8, 24);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(65, 12);
this.label4.TabIndex = 0;
this.label4.Text = "短信内容:";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.Sms_Close_Button);
this.groupBox3.Controls.Add(this.Sms_Start_Button);
this.groupBox3.Controls.Add(this.NewSms_Show);
this.groupBox3.Location = new System.Drawing.Point(280, 8);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(280, 88);
this.groupBox3.TabIndex = 6;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "自动接收短信";
//
// Sms_Close_Button
//
this.Sms_Close_Button.Location = new System.Drawing.Point(170, 56);
this.Sms_Close_Button.Name = "Sms_Close_Button";
this.Sms_Close_Button.Size = new System.Drawing.Size(76, 24);
this.Sms_Close_Button.TabIndex = 2;
this.Sms_Close_Button.Text = "关闭";
this.Sms_Close_Button.Click += new System.EventHandler(this.button5_Click);
//
// Sms_Start_Button
//
this.Sms_Start_Button.Location = new System.Drawing.Point(34, 56);
this.Sms_Start_Button.Name = "Sms_Start_Button";
this.Sms_Start_Button.Size = new System.Drawing.Size(76, 24);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -