private void cGroup_ShowContextMenu(GroupControl sender, MouseEventArgs e) { ClickGroup = sender; if (group_qcm == null) { InitGroupMenu(); } group_qcm.Show(sender, e.Location); System.GC.Collect(); }
private void qtsm_addgroup_MouseDown(object sender, MouseEventArgs e) { String name = ""; AddGroup(name); ClickGroup = Controls[StringFinal.GroupName + Groups[name].Id] as GroupControl; qtsm_rechristen_MouseDown(null, null); System.GC.Collect(); }
public void AddGroup(String groupName) { if (Groups.ContainsKey(groupName)) throw new Exception("group is exits"); groupIndex += 1; Group group = new Group(); group.OnlineCount = 0; group.Count = 0; group.Title = groupName; group.Id = groupIndex; Groups.Add(groupName, group); GroupControl cGroup = new GroupControl(); this.Anchor = ((AnchorStyles)(((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right))); this.BackColor = this.BackColor; cGroup.Location = new Point(2, 1); cGroup.Name = StringFinal.GroupName + group.Id; cGroup.Size = new Size(Width, 24); cGroup.GroupInfo = group; cGroup.ExpandChanged += new GroupControl.ExpandChangeEventHandler(cGroup_ExpandChanged); cGroup.ShowContextMenu += new GroupControl.ShowContextMenuEventHandler(cGroup_ShowContextMenu); this.Controls.Add(cGroup); Panel panel = new Panel(); panel.Anchor = ((AnchorStyles)(((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right))); panel.BackColor = this.BackColor; panel.Location = new Point(0, 0); panel.Name = StringFinal.UserPanelName + group.Id; panel.Size = new Size(this.Width, group.Count * 56); panel.Visible = false; this.Controls.Add(panel); UpdateLayout(3,group.Id); System.GC.Collect(); }
private void gm_4_Click(object sender, EventArgs e) { int id = AddGroup(); ClickGroup = Controls[StringFinal.GroupName + id] as GroupControl; gm_2_Click(null,null); }
private void cGroup_ShowContextMenu(GroupControl sender, MouseEventArgs e) { ClickGroup = sender; if (qcm == null) { InitGroupMenu(); } qcm.Show(sender, e.Location); }
public void InitFriendList(List<Group> groups) { GroupCount = groups.Count; for (int i = 0; i < groups.Count; i++) { GroupControl cGroup = new GroupControl(); this.Anchor = ((AnchorStyles)(((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right))); this.BackColor = this.BackColor; cGroup.Location = new Point(1, 24 * i + i + 1); cGroup.Name = StringFinal.GroupName + groups[i].Id; cGroup.Size = new Size(Width, 24); cGroup.GroupInfo = groups[i]; cGroup.ExpandChanged += new GroupControl.ExpandChangeEventHandler(cGroup_ExpandChanged); cGroup.ShowContextMenu += new GroupControl.ShowContextMenuEventHandler(cGroup_ShowContextMenu); //AddGroup(groups[i].Title); //this.Controls.Add(cGroup);//添加组便签 int index=groupList.Add(groups[i]); m_Group.Add(groups[i].Title, groups[i]); Panel panel = new Panel(); panel.Anchor = ((AnchorStyles)(((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right))); panel.BackColor = this.BackColor; panel.Location = new Point(0, 0); panel.Name = "userPanel_" + groups[i].Id; panel.Size = new Size(this.Width, groups[i].Count * 56); panel.Visible = false; if (groups[i].Count > 0) { for (int j = 0; j < groups[i].List.Count; j++) { Friend friendInfo = (Friend)groups[i].List[j]; if (friendInfo.State != 0 && friendInfo.State != 5) { //cGroup.GroupInfo.OnlineCount++; } friendInfo.GroupID = groups[i].Id; FriendControl friend = new FriendControl(); friend.Anchor = ((AnchorStyles)(((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right))); friend.BackColor = this.BackColor; friend.Location = new Point(1, 56 * j); friend.Name = "friend_" + friendInfo.Uin; friend.Size = new Size(panel.Width - 2, 55); friend.FriendInfo = friendInfo; friend.Selecting += new FriendControl.SelectedEventHandler(friend_Selecting); friend.ShowContextMenu += new FriendControl.ShowContextMenuEventHandler(friend_ShowContextMenu); friend.MouseDoubleClick += new MouseEventHandler(friend_MouseDoubleClick); panel.Controls.Add(friend); } } this.Controls.Add(panel);//添加联系人标签 } GC.Collect(); }
public int AddGroup(string groupName,int groupId) { Group group = new Group(); group.OnlineCount = 0; group.Count = 0; group.Title = groupName; group.Id = groupId; groupList.Add(group); m_Group.Add(group.Title, group); GroupControl cGroup = new GroupControl(); this.Anchor = ((AnchorStyles)(((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right))); this.BackColor = this.BackColor; cGroup.Location = new Point(2, 1); cGroup.Name = StringFinal.GroupName + group.Id; cGroup.Size = new Size(Width, 24); cGroup.GroupInfo = group; cGroup.ExpandChanged += new GroupControl.ExpandChangeEventHandler(cGroup_ExpandChanged); cGroup.ShowContextMenu += new GroupControl.ShowContextMenuEventHandler(cGroup_ShowContextMenu); this.Controls.Add(cGroup); Panel panel = new Panel(); panel.Anchor = ((AnchorStyles)(((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right))); panel.BackColor = this.BackColor; panel.Location = new Point(0, 0); panel.Name = StringFinal.UserPanelName + group.Id; panel.Size = new Size(Width, group.Count * 56); panel.Visible = false; this.Controls.Add(panel); //UpdateLayout(2, 0); return groupId; }