private void mnuViewUserProfile_Click(object sender, EventArgs e) { UserListItem item = lstUsers.SelectedItem as UserListItem; if (item != null) { using (frmViewProfile frm = new frmViewProfile(item.Peer)) { frm.ShowDialog(this); } } }
private void lstUsers_ItemMouseUp(object sender, MouseEventArgs e) { UserListItem item = lstUsers.SelectedItem as UserListItem; if (item != null) { if (e.Button == MouseButtons.Right) { mnuUserList.Show(sender as Control, e.Location); } else { using (frmViewProfile frm = new frmViewProfile(item.Peer)) { frm.ShowDialog(this); } } } }