Message.cs
上传用户:yan_wy
上传日期:2007-06-09
资源大小:112k
文件大小:6k
源码类别:

ICQ/即时通讯

开发平台:

C#

  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. namespace qq
  7. {
  8. /// <summary>
  9. /// Message 的摘要说明。
  10. /// </summary>
  11. public class Message : System.Windows.Forms.Form
  12. {
  13. Form1 form;
  14. string useid;
  15. UserControl1 usercontrol;
  16. private System.Windows.Forms.RichTextBox richTextBox1;
  17. private System.Windows.Forms.RichTextBox richTextBox2;
  18. private System.Windows.Forms.Button button1;
  19. private System.Windows.Forms.Label label1;
  20. private System.Windows.Forms.Label label2;
  21. private System.Windows.Forms.Label label3;
  22. private System.Windows.Forms.Label label4;
  23. private System.Windows.Forms.Button button2;
  24. /// <summary>
  25. /// 必需的设计器变量。
  26. /// </summary>
  27. private System.ComponentModel.Container components = null;
  28. public Message(Form1 f,UserControl1 ab)
  29. {
  30. //
  31. // Windows 窗体设计器支持所必需的
  32. //
  33. form=f;
  34. useid=ab.uid;
  35. usercontrol=ab;
  36. InitializeComponent();
  37. this.richTextBox1.Text=ab.tempxiao+"n";
  38. this.label4.Text=this.useid;
  39. this.label3.Text=ab.name;
  40. //
  41. // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
  42. //
  43. }
  44. /// <summary>
  45. /// 清理所有正在使用的资源。
  46. /// </summary>
  47. protected override void Dispose( bool disposing )
  48. {
  49. if( disposing )
  50. {
  51. if(components != null)
  52. {
  53. components.Dispose();
  54. }
  55. }
  56. base.Dispose( disposing );
  57. }
  58. #region Windows 窗体设计器生成的代码
  59. /// <summary>
  60. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  61. /// 此方法的内容。
  62. /// </summary>
  63. private void InitializeComponent()
  64. {
  65. this.richTextBox1 = new System.Windows.Forms.RichTextBox();
  66. this.richTextBox2 = new System.Windows.Forms.RichTextBox();
  67. this.button1 = new System.Windows.Forms.Button();
  68. this.label1 = new System.Windows.Forms.Label();
  69. this.label2 = new System.Windows.Forms.Label();
  70. this.label3 = new System.Windows.Forms.Label();
  71. this.label4 = new System.Windows.Forms.Label();
  72. this.button2 = new System.Windows.Forms.Button();
  73. this.SuspendLayout();
  74. // 
  75. // richTextBox1
  76. // 
  77. this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  78. this.richTextBox1.Location = new System.Drawing.Point(0, 40);
  79. this.richTextBox1.Name = "richTextBox1";
  80. this.richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Horizontal;
  81. this.richTextBox1.Size = new System.Drawing.Size(344, 152);
  82. this.richTextBox1.TabIndex = 0;
  83. this.richTextBox1.Text = "";
  84. // 
  85. // richTextBox2
  86. // 
  87. this.richTextBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  88. this.richTextBox2.Location = new System.Drawing.Point(0, 240);
  89. this.richTextBox2.Name = "richTextBox2";
  90. this.richTextBox2.Size = new System.Drawing.Size(344, 120);
  91. this.richTextBox2.TabIndex = 1;
  92. this.richTextBox2.Text = "";
  93. // 
  94. // button1
  95. // 
  96. this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
  97. this.button1.Location = new System.Drawing.Point(248, 208);
  98. this.button1.Name = "button1";
  99. this.button1.Size = new System.Drawing.Size(80, 24);
  100. this.button1.TabIndex = 2;
  101. this.button1.Text = "发送消息";
  102. this.button1.Click += new System.EventHandler(this.button1_Click);
  103. // 
  104. // label1
  105. // 
  106. this.label1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
  107. this.label1.Location = new System.Drawing.Point(8, 8);
  108. this.label1.Name = "label1";
  109. this.label1.Size = new System.Drawing.Size(40, 24);
  110. this.label1.TabIndex = 3;
  111. this.label1.Text = "ID";
  112. // 
  113. // label2
  114. // 
  115. this.label2.Location = new System.Drawing.Point(152, 8);
  116. this.label2.Name = "label2";
  117. this.label2.Size = new System.Drawing.Size(48, 24);
  118. this.label2.TabIndex = 5;
  119. this.label2.Text = "昵称";
  120. // 
  121. // label3
  122. // 
  123. this.label3.Location = new System.Drawing.Point(224, 8);
  124. this.label3.Name = "label3";
  125. this.label3.Size = new System.Drawing.Size(64, 24);
  126. this.label3.TabIndex = 6;
  127. this.label3.Text = "峰";
  128. // 
  129. // label4
  130. // 
  131. this.label4.Location = new System.Drawing.Point(64, 8);
  132. this.label4.Name = "label4";
  133. this.label4.Size = new System.Drawing.Size(56, 24);
  134. this.label4.TabIndex = 7;
  135. this.label4.Text = "89688209";
  136. // 
  137. // button2
  138. // 
  139. this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
  140. this.button2.Location = new System.Drawing.Point(160, 208);
  141. this.button2.Name = "button2";
  142. this.button2.Size = new System.Drawing.Size(72, 24);
  143. this.button2.TabIndex = 8;
  144. this.button2.Text = "关闭";
  145. this.button2.Click += new System.EventHandler(this.button2_Click);
  146. // 
  147. // Message
  148. // 
  149. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  150. this.ClientSize = new System.Drawing.Size(344, 357);
  151. this.Controls.Add(this.button2);
  152. this.Controls.Add(this.label4);
  153. this.Controls.Add(this.label3);
  154. this.Controls.Add(this.label2);
  155. this.Controls.Add(this.label1);
  156. this.Controls.Add(this.button1);
  157. this.Controls.Add(this.richTextBox2);
  158. this.Controls.Add(this.richTextBox1);
  159. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
  160. this.MaximizeBox = false;
  161. this.Name = "Message";
  162. this.Text = "发送消息";
  163. this.ResumeLayout(false);
  164. }
  165. #endregion
  166. private void button1_Click(object sender, System.EventArgs e)
  167. {
  168. try
  169. {
  170. if(this.richTextBox1.Text!="")
  171. {
  172. form.use.sendmessage(form.userid);
  173. form.use.sendmessage(this.useid);
  174. form.use.sendmessage(this.richTextBox2.Text);
  175. this.Close();
  176. }
  177. else MessageBox.Show("消息不能为空 ");
  178. }
  179. catch(Exception ee)
  180. {
  181. MessageBox.Show("网络不通");
  182. }
  183. }
  184. private void button2_Click(object sender, System.EventArgs e)
  185. {
  186. this.Close();
  187. }
  188. }
  189. }