public void AddPeerEmoji(Image image)//显示对方发送表情 { Bitmap Portrait = Tag.GetPortrait(); SendBox NewSend = new SendBox(image, 0, Portrait, this.Name); ChatPanel.Controls.Add(NewSend); ChatPanel.ScrollControlIntoView(NewSend); Tag.SetTime(NewSend.GetTime()); Tag.SetWords(NewSend.GetWords()); string temp = "[" + NewSend.GetTime() + "]" + Name + ":[表情]"; this.WordList.Add(temp); }
public void AddPeerText(string word, bool IsFile = false)//显示对方发送信息 { Bitmap Portrait = Tag.GetPortrait(); SendBox NewSend = new SendBox(word, 0, Portrait, this.Name); if (IsFile) { NewSend.IsFile = true; } ChatPanel.Controls.Add(NewSend); ChatPanel.ScrollControlIntoView(NewSend); Tag.SetTime(NewSend.GetTime()); Tag.SetWords(NewSend.GetWords()); string temp = "[" + NewSend.GetTime() + "]" + this.Name + ":" + word; this.WordList.Add(temp); }
public void AddMyEmoji(Image image)//显示自己发送表情 { Bitmap Portrait = BasicInfo.Portrait; SendBox NewSend = new SendBox(image, 1, Portrait, BasicInfo.UserName); ChatPanel.Controls.Add(NewSend); ChatPanel.ScrollControlIntoView(NewSend); string temp = "[" + NewSend.GetTime() + "]" + BasicInfo.UserName + ":[表情]"; this.WordList.Add(temp); }
public void AddMyText(string word)//显示自己发送信息 { Bitmap Portrait = BasicInfo.Portrait; SendBox NewSend = new SendBox(word, 1, Portrait, BasicInfo.UserName); ChatPanel.Controls.Add(NewSend); ChatPanel.ScrollControlIntoView(NewSend); string temp = "[" + NewSend.GetTime() + "]" + BasicInfo.UserName + ":" + word; this.WordList.Add(temp); }
public int RecentSave = 0; //最近一次保存聊天记录的位置 public Friend(string name, string word = "我们可以开始聊天啦", bool IsGroup = false) //新添加好友时首发信息是对话 { if (IsGroup == true) { IsGroupChat = true; } this.Name = name; Random rand = new Random((int)DateTime.Now.Ticks); int i = -1; BasicInfo.LoadPortraitList(); for (int j = 0; j < BasicInfo.PortraitList.Count(); j++) { if (name.Equals(BasicInfo.PortraitList[j].Substring(0, 10))) { i = int.Parse(BasicInfo.PortraitList[j].Substring(11, 1)); break; } } if (IsGroupChat == true)//群聊头像固定为10号 { i = 10; } if (i == -1) { i = rand.Next(1, 10);//随机生成头像信息并记录 string NewString = Name + " " + i.ToString(); BasicInfo.AddPortraitList(NewString); } Tag = new FriendTag(name, word); Tag.SetPortrait(i); PeopleCount++; Tag.setFront1 += new SetFront1(HelpsetFront); //点击标签时弹出相应对话框 InitFlowLayoutPanel(name); //初始化对话框 Bitmap Portrait = Tag.GetPortrait(); SendBox NewSend = new SendBox(word, 0, Portrait, name); string temp = "[" + NewSend.GetTime() + "]" + this.Name + ":" + word; this.WordList.Add(temp); ChatPanel.Controls.Add(NewSend);//对话框显示欢迎信息"我们可以开始聊天啦" }