2011-09-06 5 views
10

나는 데이터 그리드보기를하고 난 모든 행에 대한 행 헤더를 제거 할 나는 아래의 코드를 작성했습니다이 들어 제거 행 헤더 프로그래밍

....하지만 워킹 아니다 ....

 private void dgvProducts_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e) 
    { 
     e.PaintCells(e.ClipBounds, DataGridViewPaintParts.All); 

     e.PaintHeader(DataGridViewPaintParts.All 
      | DataGridViewPaintParts.Border 
      | DataGridViewPaintParts.None 
      | DataGridViewPaintParts.SelectionBackground 
      | DataGridViewPaintParts.ContentBackground); 

     e.Handled = true; 

    } 

는 PLS는 데이터 그리드 뷰에서 행 머리글을 제거하기 위해 어떤 샘플 코드를 줄 것이다 .... .

많은 감사합니다 미리 .....

답변

21

디자이너의 DataGridView에서 RowHeadersVisible 속성을 찾습니다. 여기서

RowHeadersVisible property set to false

+0

많은 분들께 감사 드리며 ... –

1

:

DataGridView Class

RowHeadersVisible 가져 또는 행 헤더를 포함 열이 표시되는지 여부를 나타내는 값을 설정한다.

왜이 속성을 false로 설정할 수만 있다면 RowPrePaint를 사용하여 작업 할 수 있습니다.

+0

많은 감사합니다. ..Davide .. –