c实现的一个类似QQ的局域网通讯程序.doc

c实现的一个类似QQ的局域网通讯程序.doc

  1. 1、本文档共8页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
c实现的一个类似QQ的局域网通讯程序

本文介绍了用c#实现的一个类似QQ的局域网通讯程序,当点击最小化程序跑到系统托盘里,双击托盘可以可以显示主页面。 程序运行界面如下: 托盘里的菜单如下: c#作为微软.Net战略的重要棋子,对网络编程提供了很好的支持和优化。实现起来特别方便,还是看代码吧,已经注释的很清楚了。工程文件放在后面了,需要的可以下载 代码如下: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; using System.Net.Sockets; using System.Threading; namespace p2pChat { ? ? /// summary ? ? /// MainForm 的摘要说明。 ? ? /// /summary ? ? public class MainForm : System.Windows.Forms.Form ? ? { ? ? ? ? private System.Windows.Forms.Label label1; ? ? ? ? private System.Windows.Forms.Label label2; ? ? ? ? private System.Windows.Forms.TextBox txtIp; ? ? ? ? private System.Windows.Forms.TextBox txtRecord; ? ? ? ? private System.Windows.Forms.TextBox txtName; ? ? ? ? private System.Windows.Forms.Button btnSend; ? ? ? ? private System.Windows.Forms.TextBox txtContent; ? ? ? ? private TcpListener tcpLister = new TcpListener(5566); ? ? ? ? ? ? System.Threading.ThreadStart listenPort; ? ? ? ? System.Threading.Thread lister; ? ? ? ? private System.Windows.Forms.Label label3; ? ? ? ? ? ? System.Windows.Forms.NotifyIcon NotifyIcon1; ? ? ? ? //托盘里显示的图标,我用的是QQ里的宠物狗的图标 ? ? ? ? private Icon img = new Icon(@C:\OpenPet.ico); ? ? ? ? System.Windows.Forms.ContextMenu nMenu; ? ? ? ? /// summary ? ? ? ? /// 必需的设计器变量。 ? ? ? ? /// /summary ? ? ? ? private System.ComponentModel.Container components = null; ? ? ? ? public MainForm() ? ? ? ? { ? ? ? ? ? ? ? // ? ? ? ? ? ? ? // Windows 窗体设计器支持所必需的 ? ? ? ? ? ? ? // ? ? ? ? ? ? ? InitializeComponent(); ? ? ? ? ? ? ? //不显示最大化按钮 ? ? ? ? ? ? ? this.MaximizeBox = false; ? ? ? ? ? ? ? ? ? //最小化时不显示在任务栏 ? ? ? ? ? ? ? this.ShowInTaskbar = false; ? ? ? ? ? ? ? listenPort += new ThreadStart(this.Listen); ? ? ? ? ? ? ? lister = new Thread(listenPort); ? ? ? ? ? ? ? this.Closing += new System.ComponentModel.CancelEventHandler(abortLister); ? ? ? ? ? ? ? Initializenotifyicon(); ? ? ? ? ? ? ? // ? ? ? ? ? ? ? // TODO: 在 InitializeComponent 调用后添

您可能关注的文档

文档评论(0)

tianma2015 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档