Message.cs
资源名称:类似QQ聊天程序.rar [点击查看]
上传用户:yan_wy
上传日期:2007-06-09
资源大小:112k
文件大小:6k
源码类别:
ICQ/即时通讯
开发平台:
C#
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- namespace qq
- {
- /// <summary>
- /// Message 的摘要说明。
- /// </summary>
- public class Message : System.Windows.Forms.Form
- {
- Form1 form;
- string useid;
- UserControl1 usercontrol;
- private System.Windows.Forms.RichTextBox richTextBox1;
- private System.Windows.Forms.RichTextBox richTextBox2;
- private System.Windows.Forms.Button button1;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.Button button2;
- /// <summary>
- /// 必需的设计器变量。
- /// </summary>
- private System.ComponentModel.Container components = null;
- public Message(Form1 f,UserControl1 ab)
- {
- //
- // Windows 窗体设计器支持所必需的
- //
- form=f;
- useid=ab.uid;
- usercontrol=ab;
- InitializeComponent();
- this.richTextBox1.Text=ab.tempxiao+"n";
- this.label4.Text=this.useid;
- this.label3.Text=ab.name;
- //
- // 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()
- {
- this.richTextBox1 = new System.Windows.Forms.RichTextBox();
- this.richTextBox2 = new System.Windows.Forms.RichTextBox();
- this.button1 = new System.Windows.Forms.Button();
- this.label1 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
- this.label4 = new System.Windows.Forms.Label();
- this.button2 = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // richTextBox1
- //
- this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.richTextBox1.Location = new System.Drawing.Point(0, 40);
- this.richTextBox1.Name = "richTextBox1";
- this.richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Horizontal;
- this.richTextBox1.Size = new System.Drawing.Size(344, 152);
- this.richTextBox1.TabIndex = 0;
- this.richTextBox1.Text = "";
- //
- // richTextBox2
- //
- this.richTextBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.richTextBox2.Location = new System.Drawing.Point(0, 240);
- this.richTextBox2.Name = "richTextBox2";
- this.richTextBox2.Size = new System.Drawing.Size(344, 120);
- this.richTextBox2.TabIndex = 1;
- this.richTextBox2.Text = "";
- //
- // button1
- //
- this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
- this.button1.Location = new System.Drawing.Point(248, 208);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(80, 24);
- this.button1.TabIndex = 2;
- this.button1.Text = "发送消息";
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // label1
- //
- this.label1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
- this.label1.Location = new System.Drawing.Point(8, 8);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(40, 24);
- this.label1.TabIndex = 3;
- this.label1.Text = "ID";
- //
- // label2
- //
- this.label2.Location = new System.Drawing.Point(152, 8);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(48, 24);
- this.label2.TabIndex = 5;
- this.label2.Text = "昵称";
- //
- // label3
- //
- this.label3.Location = new System.Drawing.Point(224, 8);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(64, 24);
- this.label3.TabIndex = 6;
- this.label3.Text = "峰";
- //
- // label4
- //
- this.label4.Location = new System.Drawing.Point(64, 8);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(56, 24);
- this.label4.TabIndex = 7;
- this.label4.Text = "89688209";
- //
- // button2
- //
- this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
- this.button2.Location = new System.Drawing.Point(160, 208);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(72, 24);
- this.button2.TabIndex = 8;
- this.button2.Text = "关闭";
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // Message
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
- this.ClientSize = new System.Drawing.Size(344, 357);
- this.Controls.Add(this.button2);
- this.Controls.Add(this.label4);
- this.Controls.Add(this.label3);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.label1);
- this.Controls.Add(this.button1);
- this.Controls.Add(this.richTextBox2);
- this.Controls.Add(this.richTextBox1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
- this.MaximizeBox = false;
- this.Name = "Message";
- this.Text = "发送消息";
- this.ResumeLayout(false);
- }
- #endregion
- private void button1_Click(object sender, System.EventArgs e)
- {
- try
- {
- if(this.richTextBox1.Text!="")
- {
- form.use.sendmessage(form.userid);
- form.use.sendmessage(this.useid);
- form.use.sendmessage(this.richTextBox2.Text);
- this.Close();
- }
- else MessageBox.Show("消息不能为空 ");
- }
- catch(Exception ee)
- {
- MessageBox.Show("网络不通");
- }
- }
- private void button2_Click(object sender, System.EventArgs e)
- {
- this.Close();
- }
- }
- }