1
I DataGridView를에 ColumnHeaderMouseDoubleClick 이벤트에 응답하는 다음과 같은 기능이 있습니다DataGridView를에 헤더 열의 상단에 텍스트 상자를 배치
void grid_ColumnHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) {
TextBox t = new TextBox();
//make the new textbox the same size as the header to cover it up until text is entered
t.Width = ((DataGridView)sender).CurrentCell.ContentBounds.Width;
t.Height = ((DataGridView)sender).CurrentCell.ContentBounds.Height;
t.Dock = DockStyle.Fill;
t.Visible = true;
t.BringToFront();
t.Text = "TEST";
Controls.Add(t);
}
이 코드의 모든 패널을 확장하는 클래스의 내부에서 무슨 일이 일어나고을 패널의 컨트롤에 DataGridView가 추가되었습니다. 헤더를 두 번 클릭하고이 핸들러에 중단 점을 지정하면 핸들러가 호출되지만 텍스트 상자가 어디에도 표시되지 않습니다. 아무도 내가 뭘 잘못하고 있는지 알아?