private void dgvUser_CellClick(object sender, DataGridViewCellEventArgs e) { if (dgvUser.SelectedRows.Count <= 0) { MessageBox.Show("请选择一行进行操作!"); return; } id = Convert.ToInt16(dgvUser.SelectedRows[0].Cells[0].Value); //读取数据 tboxXh.Text = dgvUser.SelectedRows[0].Cells[1].Value.ToString().Trim(); tboxPwd.Text = dgvUser.SelectedRows[0].Cells[2].Value.ToString().Trim(); tboxName.Text = dgvUser.SelectedRows[0].Cells[3].Value.ToString().Trim(); if (dgvUser.SelectedRows[0].Cells[4].Value.ToString().Trim() == "小帅哥") { cboxGender.SelectedIndex = 0; } else { cboxGender.SelectedIndex = 1; } tboxTel.Text = dgvUser.SelectedRows[0].Cells[5].Value.ToString().Trim(); tboxCorID.Text = dgvUser.SelectedRows[0].Cells[6].Value.ToString().Trim(); //加载用户头像 byte[] img = AdminManage.GetUserImg(id); pictureBox1.Image = Image.FromStream(new MemoryStream(img)); pictureBox1.SizeMode = PictureBoxSizeMode.Zoom; }