⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 用c#实现类似qq的简单通讯程序.htm

📁 用c#实现类似QQ的简单通讯程序
💻 HTM
📖 第 1 页 / 共 4 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0064)http://5550.blog.ccidnet.com/blog/ccid/do_showone/tid_18245.html -->
<HTML><HEAD><TITLE>用c#实现类似QQ的简单通讯程序 - 朴枫 -- IT博客—IT人的新家园</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content=index,follow name=robots>
<META content=IT博客—IT人的新家园 name=keywords><LINK title="RSS 2.0" 
href="http://blog.ccidnet.com/rss.php?uid=3873" type=application/rss+xml 
rel=alternate>
<STYLE>BODY {
	FONT-SIZE: 12px; BACKGROUND: #ffffff; MARGIN: 0px; FONT-FAMILY: verdana,arial,helvetica; TEXT-ALIGN: center
}
FORM {
	DISPLAY: inline; MARGIN: 0px
}
TD {
	BORDER-RIGHT: 1px; BORDER-TOP: 0px; FONT-SIZE: 9pt
}
.content {
	FONT-SIZE: 12px; COLOR: #2d2d2d; LINE-HEIGHT: 17px; TEXT-DECORATION: none
}
.comment {
	BORDER-RIGHT: #373737 1px dashed; PADDING-RIGHT: 4px; BORDER-TOP: #373737 1px dashed; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; BORDER-LEFT: #373737 1px dashed; COLOR: #373737; PADDING-TOP: 4px; BORDER-BOTTOM: #373737 1px dashed; BACKGROUND-COLOR: #ffffff
}
A {
	LINE-HEIGHT: 160%; TEXT-DECORATION: none
}
A:hover {
	TEXT-DECORATION: underline
}
.p9 {
	FONT-SIZE: 9pt; COLOR: #ffffff; LINE-HEIGHT: 17px; FONT-FAMILY: "Arial", "Helvetica", "sans-serif", "宋体"; TEXT-DECORATION: none
}
.p13 {
	FONT-SIZE: 13px; COLOR: #000000; LINE-HEIGHT: 18px; TEXT-DECORATION: none
}
.p14 {
	FONT-SIZE: 14px; COLOR: #000000; LINE-HEIGHT: 20px; TEXT-DECORATION: none
}
.p17 {
	FONT-SIZE: 18px; COLOR: #01007f; LINE-HEIGHT: 22px; TEXT-DECORATION: none
}
.p18 {
	FONT-WEIGHT: bold; FONT-SIZE: 18px; COLOR: #000000; LINE-HEIGHT: 23px; FONT-FAMILY: "黑体"; TEXT-DECORATION: none
}
.p19 {
	FONT-SIZE: 20px; COLOR: #000000; LINE-HEIGHT: 30px; TEXT-DECORATION: none
}
.yinying {
	FILTE: DropShadow(Color=#0033bb, OffX=1, OffY=1, Positive=1)
}
.time {
	FONT-SIZE: 10px; COLOR: #000000; FONT-FAMILY: "Arial", "Helvetica", "sans-serif"; TEXT-DECORATION: none
}
.side_center {
	PADDING-RIGHT: 2px; PADDING-LEFT: 2px; FONT-SIZE: 12px; PADDING-BOTTOM: 2px; PADDING-TOP: 2px; TEXT-ALIGN: center
}
.side_calendar {
	FONT-WEIGHT: bold; FONT-SIZE: 16px
}
.bp16_4 {
	FONT-SIZE: 16px; COLOR: #1584a6; LINE-HEIGHT: 22px; TEXT-DECORATION: none
}
.subject {
	FONT-SIZE: 16px; COLOR: #1584a6; LINE-HEIGHT: 22px; TEXT-DECORATION: none
}
.xml {
	BORDER-RIGHT: #8c8e7b 1px solid; BORDER-TOP: #8c8e7b 1px solid; BACKGROUND: #ffffff; BORDER-LEFT: #8c8e7b 1px solid; BORDER-BOTTOM: #8c8e7b 1px solid; FONT-FAMILY: Tahoma, Verdana
}
.xml A {
	COLOR: #ffffff
}
.xml_1 {
	FONT-SIZE: 7pt; BACKGROUND: #ff6500; COLOR: #ffffff
}
.xml_2 {
	FONT-SIZE: 7pt; BACKGROUND: #8c8e7b; COLOR: #ffffff
}
.notice {
	FONT-SIZE: 9pt; COLOR: #ffffff; LINE-HEIGHT: 19px; TEXT-DECORATION: none
}
</STYLE>

<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginwidth="0">
<TABLE class=content cellSpacing=0 cellPadding=5 width=760 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=47 src="用c#实现类似QQ的简单通讯程序.files/1213_logo.gif" 
width=154></TD>
    <TD vAlign=baseline align=right><A class=content 
      href="http://blog.ccidnet.com/index/ccid/index.html">博客首页</A> | <A 
      class=content href="http://blog.ccidnet.com/search/ccid/index.html">搜索</A> 
      | <A class=content 
      href="http://blog.ccidnet.com/login/ccid/index.html">登录</A> | <A 
      class=content 
      href="http://blog.ccidnet.com/register/ccid/index.html">注册</A> 
  </TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=760 
background=用c#实现类似QQ的简单通讯程序.files/1209-bg-1.gif border=0>
  <TBODY>
  <TR>
    <TD><IMG height=7 src="用c#实现类似QQ的简单通讯程序.files/blank.gif" 
  width=20></TD></TR></TBODY></TABLE>
<TABLE height=110 cellSpacing=0 cellPadding=0 width=760 
background=用c#实现类似QQ的简单通讯程序.files/760110b.gif border=0>
  <TBODY>
  <TR>
    <TD align=middle>
      <TABLE class=p18 cellSpacing=1 cellPadding=1 width=300 bgColor=#444444 
      border=0>
        <TBODY>
        <TR>
          <TD class=p18 bgColor=#f3f4e1><B><IMG height=18 
            src="用c#实现类似QQ的简单通讯程序.files/blank.gif" 
      width=10>朴枫</B></TD></TR></TBODY></TABLE><BR>
      <TABLE class=content cellSpacing=1 cellPadding=1 width=300 bgColor=#444444 
      border=0>
        <TBODY>
        <TR>
          <TD bgColor=#f3f4e1><B><IMG height=12 
            src="用c#实现类似QQ的简单通讯程序.files/blank.gif" width=10></B><A class=content 
            href="http://mtv.blog.ccidnet.com/">http://mtv.blog.ccidnet.com/</A> 
            <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            &gt;&gt;<A class=content 
            onclick="clipboardData.setData('Text','http://mtv.blog.ccidnet.com');alert('复制链接成功,请推荐给好友!');" 
            href="javascript:">复制</A> &gt;&gt;<A class=content 
            onclick="window.external.addFavorite('http://mtv.blog.ccidnet.com','用c#实现类似QQ的简单通讯程序 - 朴枫 -- IT博客—IT人的新家园');" 
            href="javascript:">收藏本页</A></TD></TR></TBODY></TABLE></TD>
    <TD width=221></TD></TR></TBODY></TABLE><IMG height=3 
src="用c#实现类似QQ的简单通讯程序.files/blank.gif" width=20><BR>
<TABLE cellSpacing=0 cellPadding=0 width=760 border=0>
  <TBODY>
  <TR>
    <TD style="BORDER-RIGHT: #bbd8e2 1px solid; BORDER-LEFT: #bbd8e2 1px solid" 
    vAlign=top align=middle>
      <TABLE class=p9 cellSpacing=0 cellPadding=3 width="100%" bgColor=#449fbb 
      border=0>
        <TBODY>
        <TR>
          <TD>
            <MARQUEE onmouseover=this.stop() onmouseout=this.start() 
            scrollAmount=4 direction=level height="100%"><A class=notice 
            href="http://blog.ccidnet.com/" target=_blank>赛迪博客</A><FONT 
            class=notice>系统公告:</FONT>&nbsp;&nbsp;<A class=notice 
            href="http://blog.ccidnet.com/notice.php?aid=7" 
            target=_blank>企业广告发布规定</A> &nbsp;&nbsp;&nbsp;&nbsp;<A class=notice 
            href="http://blog.ccidnet.com/notice.php?aid=4" 
            target=_blank>春天换新装,博客要扮靓</A> &nbsp;&nbsp;&nbsp;&nbsp;<A 
            class=notice href="http://blog.ccidnet.com/notice.php?aid=9" 
            target=_blank>IT博客征文进行中!</A> &nbsp;&nbsp;&nbsp;&nbsp;<A class=notice 
            href="http://blog.ccidnet.com/notice.php?aid=11" target=_blank>IBM 
            developerWorks 专区新版上线</A> 
        &nbsp;&nbsp;&nbsp;&nbsp;</MARQUEE></TD></TR></TBODY></TABLE><IMG height=3 
      src="用c#实现类似QQ的简单通讯程序.files/blank.gif" width=20><BR>
      <TABLE class=content cellSpacing=0 cellPadding=3 width="100%" 
      bgColor=#bbd8e2 border=0>
        <TBODY>
        <TR>
          <TD><IMG height=10 hspace=5 
            src="用c#实现类似QQ的简单通讯程序.files/1209-icon-4.gif" width=9 align=absMiddle 
            vspace=1> <SPAN 
            style="TABLE-LAYOUT: fixed; WORD-WRAP: break-word"><A class=content 
            href="http://mtv.blog.ccidnet.com/blog/ccid/uid_3873.html"><B>全部文章</B></A> 
            </SPAN></TD></TR></TBODY></TABLE><IMG height=8 
      src="用c#实现类似QQ的简单通讯程序.files/blank.gif" width=20><BR>
      <TABLE class=content cellSpacing=0 cellPadding=2 width="95%" border=0>
        <TBODY>
        <TR>
          <TD align=middle><SPAN class=p19><B>用c#实现类似QQ的简单通讯程序</B> 
            </SPAN><BR>作者: lhuam 发表日期: 2006-01-12 12:35 文章属性: 原创 <A 
            class=content 
            title=http://mtv.blog.ccidnet.com/blog/ccid/do_showone/tid_18245.html 
            onclick="clipboardData.setData('Text','http://mtv.blog.ccidnet.com/blog/ccid/do_showone/tid_18245.html'); alert('复制链接成功,请推荐好友!');" 
            href="javascript:">复制链接</A> </TD></TR>
        <TR>
          <TD>
            <DIV class=content 
            style="TABLE-LAYOUT: fixed; WORD-WRAP: break-word"><BR><BR><SPAN 
            class=content>本文介绍了用c#实现的一个类似QQ的局域网通讯程序,当点击最小化程序跑到系统托盘里,双击托盘可以可以显示主页面。<BR>程序运行界面如下:<BR><B></B><BR><IMG 
            height=479 src="用c#实现类似QQ的简单通讯程序.files/10_3873_5c9207776c8bb20.jpg" 
            width=304 border=0><BR><BR>托盘里的菜单如下:<BR><B></B><BR><IMG height=69 
            src="用c#实现类似QQ的简单通讯程序.files/10_3873_5c86dac55b1bcec.jpg" width=129 
            border=0><BR><BR>c#作为微软.Net战略的重要棋子,对网络编程提供了很好的支持和优化。实现起来特别方便,还是看代码吧,已经注释的很清楚了。工程文件放在后面了,需要的可以下载<BR>代码如下:<BR>using 
            System;<BR>using System.Drawing;<BR>using 
            System.Collections;<BR>using System.ComponentModel;<BR>using 
            System.Windows.Forms;<BR>using System.Data;<BR>using 
            System.IO;<BR>using System.Net.Sockets;<BR>using 
            System.Threading;<BR>namespace p2pChat<BR>{<BR>&nbsp; &nbsp; /// 
            &lt;summary&gt;<BR>&nbsp; &nbsp; /// MainForm 的摘要说明。<BR>&nbsp; 
            &nbsp; /// &lt;/summary&gt;<BR>&nbsp; &nbsp; public class MainForm : 
            System.Windows.Forms.Form<BR>&nbsp; &nbsp; {<BR>&nbsp; &nbsp; &nbsp; 
            &nbsp; private System.Windows.Forms.Label label1;<BR>&nbsp; &nbsp; 
            &nbsp; &nbsp; private System.Windows.Forms.Label label2;<BR>&nbsp; 
            &nbsp; &nbsp; &nbsp; private System.Windows.Forms.TextBox 
            txtIp;<BR>&nbsp; &nbsp; &nbsp; &nbsp; private 
            System.Windows.Forms.TextBox txtRecord;<BR>&nbsp; &nbsp; &nbsp; 
            &nbsp; private System.Windows.Forms.TextBox txtName;<BR>&nbsp; 
            &nbsp; &nbsp; &nbsp; private System.Windows.Forms.Button 
            btnSend;<BR>&nbsp; &nbsp; &nbsp; &nbsp; private 
            System.Windows.Forms.TextBox txtContent;<BR>&nbsp; &nbsp; &nbsp; 
            &nbsp; private TcpListener tcpLister = new TcpListener(5566); &nbsp; 
            &nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; System.Threading.ThreadStart 
            listenPort;<BR>&nbsp; &nbsp; &nbsp; &nbsp; System.Threading.Thread 
            lister;<BR>&nbsp; &nbsp; &nbsp; &nbsp; private 
            System.Windows.Forms.Label label3; &nbsp; &nbsp; <BR>&nbsp; &nbsp; 
            &nbsp; &nbsp; System.Windows.Forms.NotifyIcon NotifyIcon1;<BR>&nbsp; 
            &nbsp; &nbsp; &nbsp; //托盘里显示的图标,我用的是QQ里的宠物狗的图标<BR>&nbsp; &nbsp; 
            &nbsp; &nbsp; private Icon img = new 
            Icon(@"C:\OpenPet.ico");<BR>&nbsp; &nbsp; &nbsp; &nbsp; 
            System.Windows.Forms.ContextMenu nMenu;<BR>&nbsp; &nbsp; &nbsp; 
            &nbsp; /// &lt;summary&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp; /// 
            必需的设计器变量。<BR>&nbsp; &nbsp; &nbsp; &nbsp; /// 
            &lt;/summary&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp; private 
            System.ComponentModel.Container components = null;<BR>&nbsp; &nbsp; 
            &nbsp; &nbsp; public MainForm()<BR>&nbsp; &nbsp; &nbsp; &nbsp; 
            {<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //<BR>&nbsp; 
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Windows 
            窗体设计器支持所必需的<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            //<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            InitializeComponent();<BR><BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            &nbsp; &nbsp; //不显示最大化按钮<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            &nbsp; &nbsp; this.MaximizeBox = false; &nbsp; &nbsp; <BR>&nbsp; 
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //最小化时不显示在任务栏<BR>&nbsp; 
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.ShowInTaskbar = 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -