• 大小: 515KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-06
  • 语言: C#
  • 标签: c#  

资源简介

此代码是在C#的编程语言的基础上,可运行

资源截图

代码片段和文件信息

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Net;
using System.Net.Sockets;
using System.Threading;

namespace myChatClient
{
    public partial class client_main_form : Form
    {
        
        //登录的窗体
        private Form1 register_form;

        //与服务器的连接
        TcpClient tcpClient;

        //与服务器数据交互的流通道
        private NetworkStream Stream;

        //客服端信息
        string[] user_info;

        //客户端的状态
        private static string CLOSED = “closed“;
        private static string CONNECTED = “connected“;
        private string state = CLOSED;

        private bool stopFlag;

        private Color color;

        // This delegate enables asynchronous calls for setting
        // the text property on a TextBox control.
        delegate void SetTextCallback(string text);

        delegate void SetTextCallback2(string[] tokens);

        public client_main_form(Form1 register_form TcpClient tcpClient NetworkStream Stream string[] user_info)
        {
            InitializeComponent();

            this.register_form = register_form;
            this.tcpClient = tcpClient;
            this.Stream = Stream;

            this.user_info = user_info; 
        }

/// 
/// Clean up any resources being used.
/// 

protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null) 
{
components.Dispose();
}
}
base.Dispose( disposing );
}

        //更新在线用户列表
        private void update_user_list(string[] tokens)
        {
            if (this.lstUsers.InvokeRequired)
            {
                SetTextCallback2 d = new SetTextCallback2(update_user_list);
                this.Invoke(d new object[] { tokens });
            }
            else
            {
                lstUsers.Items.Clear();
                for (int i = 1; i < tokens.Length - 1; i++)
                {
                    lstUsers.Items.Add(tokens[i].Trim());
                }
            }
        }
        //添加在线用户列表
        private void add_user_list(string[] tokens)
        {
            if (this.lstUsers.InvokeRequired)
            {
                SetTextCallback2 d = new SetTextCallback2(add_user_list);
                this.Invoke(d new object[] { tokens });
            }
            else
            {
                this.lstUsers.Items.Add(tokens[1]);
            }
        }

        private void add(string msg)
        {
            if (this.rtbMsg.InvokeRequired)
            {
                SetTextCallback d = new SetTextCallback(add);
                this.Invoke(d new object[] { msg });
            }
            else
            {
                if (!color.IsEmpty)
                {
                    this.rtbMsg.SelectionColor = color;
                }
      

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     819200  2006-11-23 13:45  bk\myChatClient\myChatClient\bin\Debug\myChatClient.exe

     文件      42496  2006-11-23 13:45  bk\myChatClient\myChatClient\bin\Debug\myChatClient.pdb

     文件       5632  2005-12-08 14:51  bk\myChatClient\myChatClient\bin\Debug\myChatClient.vshost.exe

     文件     118350  2006-11-21 11:10  bk\myChatClient\myChatClient\bin\Debug\Resources\中标1.BMP

     文件      63438  2006-11-21 15:27  bk\myChatClient\myChatClient\bin\Debug\Resources\女.BMP

     文件      63950  2006-11-21 10:55  bk\myChatClient\myChatClient\bin\Debug\Resources\小标.BMP

     文件      62982  2006-11-21 10:58  bk\myChatClient\myChatClient\bin\Debug\Resources\男.BMP

     文件      13965  2006-11-23 13:44  bk\myChatClient\myChatClient\client_main_form.cs

     文件      12124  2006-11-23 13:27  bk\myChatClient\myChatClient\client_main_form.Designer.cs

     文件       5814  2006-11-23 13:27  bk\myChatClient\myChatClient\client_main_form.resx

     文件       5720  2006-11-23 02:52  bk\myChatClient\myChatClient\Form1.cs

     文件       8195  2006-11-23 02:15  bk\myChatClient\myChatClient\Form1.Designer.cs

     文件       5814  2006-11-23 02:15  bk\myChatClient\myChatClient\Form1.resx

     文件       4345  2006-11-21 15:28  bk\myChatClient\myChatClient\myChatClient.csproj

     文件        180  2006-11-23 13:32  bk\myChatClient\myChatClient\obj\Debug\myChatClient.client_main_form.resources

     文件       1143  2006-11-23 13:32  bk\myChatClient\myChatClient\obj\Debug\myChatClient.csproj.GenerateResource.Cache

     文件     819200  2006-11-23 13:45  bk\myChatClient\myChatClient\obj\Debug\myChatClient.exe

     文件        180  2006-11-23 02:15  bk\myChatClient\myChatClient\obj\Debug\myChatClient.Form1.resources

     文件      42496  2006-11-23 13:45  bk\myChatClient\myChatClient\obj\Debug\myChatClient.pdb

     文件     477194  2006-11-21 15:28  bk\myChatClient\myChatClient\obj\Debug\myChatClient.Properties.Resources.resources

     文件     118350  2006-11-21 11:10  bk\myChatClient\myChatClient\obj\Debug\myChatClient.Resources.中标1.BMP

     文件      63438  2006-11-21 15:27  bk\myChatClient\myChatClient\obj\Debug\myChatClient.Resources.女.BMP

     文件      63950  2006-11-21 10:55  bk\myChatClient\myChatClient\obj\Debug\myChatClient.Resources.小标.BMP

     文件      62982  2006-11-21 10:58  bk\myChatClient\myChatClient\obj\Debug\myChatClient.Resources.男.BMP

     文件       5120  2006-11-21 15:28  bk\myChatClient\myChatClient\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll

     文件        652  2006-11-23 13:46  bk\myChatClient\myChatClient\obj\myChatClient.csproj.FileList.txt

     文件        478  2006-11-23 00:56  bk\myChatClient\myChatClient\Program.cs

     文件       1172  2006-11-18 21:24  bk\myChatClient\myChatClient\Properties\AssemblyInfo.cs

     文件       4338  2006-11-21 15:28  bk\myChatClient\myChatClient\Properties\Resources.Designer.cs

     文件       7398  2006-11-21 15:28  bk\myChatClient\myChatClient\Properties\Resources.resx

............此处省略69个文件信息

评论

共有 条评论