运用了Windows自身带有的服务(Messages),通过打开此服务而发送相关消息
源代码在线查看: form1.designer.cs
namespace 实现通讯信使
{
partial class Form1
{
///
/// 必需的设计器变量。
///
private System.ComponentModel.IContainer components = null;
///
/// 清理所有正在使用的资源。
///
/// 如果应释放托管资源,为 true;否则为 false。
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
///
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
///
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.but_send = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.txt_Details = new System.Windows.Forms.RichTextBox();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.txt_server = new System.Windows.Forms.ComboBox();
this.button1 = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// but_send
//
this.but_send.Location = new System.Drawing.Point(53, 231);
this.but_send.Name = "but_send";
this.but_send.Size = new System.Drawing.Size(75, 23);
this.but_send.TabIndex = 0;
this.but_send.Text = "发送";
this.but_send.UseVisualStyleBackColor = true;
this.but_send.Click += new System.EventHandler(this.but_send_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 60);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(113, 12);
this.label1.TabIndex = 1;
this.label1.Text = "IP地址或机器名称:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 90);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(41, 12);
this.label2.TabIndex = 2;
this.label2.Text = "内容:";
//
// txt_Details
//
this.txt_Details.Location = new System.Drawing.Point(53, 87);
this.txt_Details.Name = "txt_Details";
this.txt_Details.Size = new System.Drawing.Size(227, 138);
this.txt_Details.TabIndex = 4;
this.txt_Details.Text = "sss";
//
// timer1
//
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// txt_server
//
this.txt_server.FormattingEnabled = true;
this.txt_server.Items.AddRange(new object[] {
"192.168.1.102"});
this.txt_server.Location = new System.Drawing.Point(125, 57);
this.txt_server.Name = "txt_server";
this.txt_server.Size = new System.Drawing.Size(155, 20);
this.txt_server.TabIndex = 5;
this.txt_server.Text = "192.168.1.112";
//
// button1
//
this.button1.Location = new System.Drawing.Point(153, 231);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 6;
this.button1.Text = "取消";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 261);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(41, 12);
this.label3.TabIndex = 7;
this.label3.Text = "状态:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(51, 261);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(41, 12);
this.label4.TabIndex = 8;
this.label4.Text = "label4";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 282);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.button1);
this.Controls.Add(this.txt_server);
this.Controls.Add(this.txt_Details);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.but_send);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button but_send;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.RichTextBox txt_Details;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.ComboBox txt_server;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
}
}