void host_CloseClick(object sender, EventArgs e) { UserInfoControlHost host = sender as UserInfoControlHost; //UserMessage.Delete(host.User); this.Items.Remove(host); if (this.Items.Count < 1) { this.Hide(); } }
public UserInfoDropDown(List<UserEntity> userList) { if (userList == null || userList.Count < 1) return; this.MaximumSize = new System.Drawing.Size(250, 500); foreach (UserEntity entity in userList) { UserInfoControlHost host = new UserInfoControlHost(entity); host.CloseClick += new EventHandler(host_CloseClick); host.UserClick += new EventHandler<LoginEventArgs>(host_UserClick); host.UpItem += new EventHandler<LoginEventArgs>(host_UpItem); host.DownItem += new EventHandler<LoginEventArgs>(host_DownItem); host.ResetControlBackColor += new EventHandler(host_ResetBackColor); host.ResetControlBackColor += new EventHandler(host_ResetBackColor); this.Items.Add(host); } (this.Items[0] as ToolStripControlHost).Focus(); }
public UserInfoDropDown(List <UserEntity> userList) { if (userList == null || userList.Count < 1) { return; } this.MaximumSize = new System.Drawing.Size(250, 500); foreach (UserEntity entity in userList) { UserInfoControlHost host = new UserInfoControlHost(entity); host.CloseClick += new EventHandler(host_CloseClick); host.UserClick += new EventHandler <LoginEventArgs>(host_UserClick); host.UpItem += new EventHandler <LoginEventArgs>(host_UpItem); host.DownItem += new EventHandler <LoginEventArgs>(host_DownItem); host.ResetControlBackColor += new EventHandler(host_ResetBackColor); host.ResetControlBackColor += new EventHandler(host_ResetBackColor); this.Items.Add(host); } (this.Items[0] as ToolStripControlHost).Focus(); }