用c#编写聊天程序

用c#编写聊天程序

ID:37508359

大小:44.50 KB

页数:16页

时间:2019-05-24

用c#编写聊天程序_第1页
用c#编写聊天程序_第2页
用c#编写聊天程序_第3页
用c#编写聊天程序_第4页
用c#编写聊天程序_第5页
资源描述:

《用c#编写聊天程序》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、usingSystem;usingSystem.Drawing;usingSystem.Collections;usingSystem.ComponentModel;usingSystem.Windows.Forms;usingSystem.Data;usingSystem.Threading;usingSystem.Net.Sockets;usingSystem.Net;namespaceChat_Server{//////Form1的摘要说明。///publicclassForm1:System.Windows.Forms.

2、Form{//////必需的设计器变量。///privateSystem.ComponentModel.Containercomponents=null; staticintlistenport=6666;Socketclientsocket;privateSystem.Windows.Forms.ListBoxlbClients;ArrayListclients;privateSystem.Windows.Forms.Buttonbutton1;Threadclientservice;privateSystem.Windows

3、.Forms.Labellabel1;ThreadthreadListen;publicForm1(){InitializeComponent();}//////清理所有正在使用的资源。///protectedoverridevoidDispose(booldisposing){if(disposing){if(clientservice!=null){clientservice.Abort();}if(threadListen!=null){try{threadListen.Abort();}catch(Exceptionex

4、){threadListen=null;}}if(components!=null){components.Dispose();}}base.Dispose(disposing);}#regionWindows窗体设计器生成的代码//////设计器支持所需的方法-不要使用代码编辑器修改///此方法的内容。///privatevoidInitializeComponent(){this.lbClients=newSystem.Windows.Forms.ListBox();this.button1=newSystem.Window

5、s.Forms.Button();this.label1=newSystem.Windows.Forms.Label();this.SuspendLayout();////lbClients//this.lbClients.ItemHeight=12;this.lbClients.Location=newSystem.Drawing.Point(16,24);this.lbClients.Name="lbClients";this.lbClients.Size=newSystem.Drawing.Size(184,268);th

6、is.lbClients.TabIndex=0;////button1//this.button1.Location=newSystem.Drawing.Point(272,56);this.button1.Name="button1";this.button1.TabIndex=1;this.button1.Text="button1";this.button1.Click+=newSystem.EventHandler(this.button1_Click);////label1//this.label1.Location=

7、newSystem.Drawing.Point(240,136);this.label1.Name="label1";this.label1.Size=newSystem.Drawing.Size(120,32);this.label1.TabIndex=2;this.label1.Text="label1";////Form1//this.AutoScaleBaseSize=newSystem.Drawing.Size(6,14);this.ClientSize=newSystem.Drawing.Size(368,309);

8、this.Controls.Add(this.label1);this.Controls.Add(this.button1);this.Controls.Add(this.lbClients);this.Name="Form1";this.Text="Form1

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。