public ChatForm(GGUserInfo fromUser, GGUserInfo toUser) { InitializeComponent();//选择好友私聊 Control.CheckForIllegalCrossThreadCalls = false; this.showMsgDelMethod = this.ShowMsgDelMethodImpl; SingleUtils.fromUser = fromUser; SingleUtils.toUser = toUser; toInfo.toId = toUser.userId; toInfo.toUser = SingleUtils.toUser; string chatFormKey = GGUserUtils.GetChatFormKey(SingleUtils.fromUser, SingleUtils.toUser); SingleUtils.AddChatForm(chatFormKey, this); this.Size = new System.Drawing.Size(400, 400); this.Tag = chatFormKey; this.Text = "你" + GGUserUtils.ShowNickAndId(SingleUtils.fromUser) + "正在和" + GGUserUtils.ShowNickAndId(SingleUtils.toUser) + "聊天 chatFormKey=" + chatFormKey; //表情选择面板 SingleUtils.emojiForm.VisibleChanged += new EventHandler(this.GetEmoji); SingleUtils.emojiForm.Show(); SingleUtils.emojiForm.WindowState = FormWindowState.Minimized; SingleUtils.emojiForm.Visible = false; }
private void ChatForm_FormClosing(object sender, FormClosingEventArgs e) { string chatFormKey = this.Tag.ToString(); SingleUtils.chatForm.Remove(chatFormKey); this.showMsgDelMethod = null; }