728x90

엑셀처럼 셀을 클릭하면 해당 셀을 상단의 공간에 보여주기 위한 용도로 활용해봤다.


private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
       lbl_View.Text = this.dataGridView1[e.ColumnIndex, e.RowIndex].Value.ToString();
}


// MouseDown 이벤트 : 마우스 포인터가 컨트롤 위에 있을 때 마우스 단추를 클릭하면 발생

private void dataGridView1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
{
    lbl_View1.Text = this.dataGridView1[e.ColumnIndex, e.RowIndex].Value.ToString();
}


// MouseClick 이벤트 : 컨트롤을 마우스로 클릭할 때 발생

블로그 이미지

Link2Me

,