• 大小: 675.85 KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2024-12-21
  • 语言: C#
  • 标签:

资源简介

实现简单的QQ聊天功能,用于对c#的基础学习

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace qqstyle
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

        }

        private void Form1_Load(object sender EventArgs e)
        {
            this.timeShow.Start();
            this.tview.Nodes.Clear();
            List  users= new UserDataSource().GetAll();
            Dictionary> userDic = new Dictionary>();

            foreach (User user in users)
            {
                if (!userDic.ContainsKey(user.Category))
                {
                    userDic.Add(user.Category new List());
                }
                userDic[user.Category].Add(user);
            }

            foreach (string category in userDic.Keys)
            {
                TreeNode node = new TreeNode(category 1 1);
                foreach (User user in userDic[category])
                {
                    TreeNode usernode = new TreeNode(user.UserName user.ImageIndex user.ImageIndex);
                    usernode.ToolTipText = user.Description;

                    usernode.Tag = user;

                    node.Nodes.Add(usernode);
                }
                this.tview.Nodes.Add(node);
            }
            //this.tview.Nodes.Clear();
            //this.FullUsers();
        }

        private void FullUsers()
        {
            TreeNode friendNode = new TreeNode(“好友“ 0 0);
            friendNode.Nodes.AddRange(new TreeNode[]{
                            new TreeNode(“时间“11)
                            new TreeNode(“回不“22)
                            new TreeNode(“到最“33)
                            new TreeNode(“地点“44)
            });

            TreeNode node1 = new TreeNode(“黑名单“ 1 1);
            node1.Nodes.AddRange(new TreeNode[] {
                            new TreeNode(“时间“11)
                            new TreeNode(“回不“22)
                            new TreeNode(“到最“33)
                            new TreeNode(“地点“44)
            });

            this.tview.Nodes.Add(friendNode);
            this.tview.Nodes.Add(node1);

        }
        private Dictionary showmsg = new Dictionary();
        private void tview_NodeMouseDoubleClick(object sender TreeNodeMouseClickEventArgs e)
        {
            User user = e.Node.Tag as User;
            if (user != null)
            {
                if (showUser.Contains(user.UserName))
                {
                    if (showmsg.ContainsKey(user.UserName))
                    {
                        Showmessage showmessage = showmsg[user.UserName];
                        showmessage.Show();
                    }

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

     文件       5067  2010-08-19 18:02  qqstyle\Backup\qqstyle\Form1.cs

     文件      13926  2010-08-19 16:36  qqstyle\Backup\qqstyle\Form1.Designer.cs

     文件      14149  2010-08-19 16:36  qqstyle\Backup\qqstyle\Form1.resx

     文件        488  2010-08-19 13:46  qqstyle\Backup\qqstyle\Program.cs

     文件       1370  2010-08-19 13:46  qqstyle\Backup\qqstyle\Properties\AssemblyInfo.cs

     文件       3639  2010-08-19 15:01  qqstyle\Backup\qqstyle\Properties\Resources.Designer.cs

     文件       6731  2010-08-19 15:01  qqstyle\Backup\qqstyle\Properties\Resources.resx

     文件       1092  2010-08-19 13:46  qqstyle\Backup\qqstyle\Properties\Settings.Designer.cs

     文件        249  2010-08-19 13:46  qqstyle\Backup\qqstyle\Properties\Settings.settings

     文件       4832  2010-08-19 17:15  qqstyle\Backup\qqstyle\qqstyle.csproj

     文件      28521  2010-08-19 15:01  qqstyle\Backup\qqstyle\Resources\Blue hills.jpg

     文件      83794  2010-08-19 15:01  qqstyle\Backup\qqstyle\Resources\Water lilies.jpg

     文件       4723  2010-08-19 13:51  qqstyle\Backup\qqstyle\Resources\zh_cn_Win7_100413[1].png

     文件        369  2010-08-19 17:15  qqstyle\Backup\qqstyle\Showmessage.cs

     文件       7027  2010-08-19 17:15  qqstyle\Backup\qqstyle\Showmessage.Designer.cs

     文件       5814  2010-08-19 17:15  qqstyle\Backup\qqstyle\Showmessage.resx

     文件       1145  2010-08-19 14:44  qqstyle\Backup\qqstyle\User.cs

     文件        911  2010-08-19 14:44  qqstyle\Backup\qqstyle\UserDataSource.cs

     文件        864  2010-08-19 15:54  qqstyle\Backup\qqstyle\userMessage.cs

     文件       6713  2010-08-19 15:54  qqstyle\Backup\qqstyle\userMessage.Designer.cs

     文件       5814  2010-08-19 15:54  qqstyle\Backup\qqstyle\userMessage.resx

     文件        911  2010-08-19 13:46  qqstyle\Backup\qqstyle.sln

    ..A..H.     17920  2010-08-26 17:21  qqstyle\Backup\qqstyle.suo

     文件     148480  2010-08-19 18:02  qqstyle\qqstyle\bin\Debug\qqstyle.exe

     文件      50688  2010-08-19 18:02  qqstyle\qqstyle\bin\Debug\qqstyle.pdb

     文件      11608  2010-12-20 21:46  qqstyle\qqstyle\bin\Debug\qqstyle.vshost.exe

     文件       5067  2010-08-19 18:02  qqstyle\qqstyle\Form1.cs

     文件      13926  2010-08-19 16:36  qqstyle\qqstyle\Form1.Designer.cs

     文件      14149  2010-08-19 16:36  qqstyle\qqstyle\Form1.resx

     文件       6313  2010-12-20 21:45  qqstyle\qqstyle\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

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

评论

共有 条评论

相关资源