0
여기 코드는 내가 작성한 코드입니다. img.Image.FromFile();
전체 경로를 작성했지만 Pics 폴더에서 사진을 선택해야합니다. 나는 DataGridView
의 선택이 바뀌었을 때 내가 썼던 길을 의미한다. 나는 내 자신의 노트북에서만 사진을 본다.img.Image.FromFile()에서 올바른 경로 설정;
private void dataGridViewSearch_SelectionChanged(object sender, EventArgs e)
{
if (dataGridViewSearch.SelectedRows.Count == 0) return;
dataGridViewSearch.Visible = false;
if (dataGridViewSearch.CurrentCell.ColumnIndex == 0)
{
buttonB.Visible = true;
int n = dataGridViewSearch.CurrentRow.Index;
string imgName = arr2[n].Pic;
img = Image.FromFile("C:/Users/baghd/Summer2016/Desktop/1/Pics/" + imgName);
//img = Image.FromFile("Pictures/" + imgName);
pictureBox1.Image = img;
pictureBox1.Visible = true;
}
else { }
//C:/Users/baghd/Summer2016/Desktop/1/
}
고마워, 너무 늦게 답변 해 주셔서 죄송합니다. –