문제

나는 어떻게 변화의 글꼴 크기 DataGridView?

도움이 되었습니까?

해결책

    private void UpdateFont()
    {
        //Change cell font
        foreach(DataGridViewColumn c in dgAssets.Columns)
        {
            c.DefaultCellStyle.Font = new Font("Arial", 8.5F, GraphicsUnit.Pixel);
        }
    }

다른 팁

에 winform datagrid,마우스 오른쪽 단추로 클릭하십시오 속성을 확인합니다.그것은 시설이라고 DefaultCellStyle.클릭에 DefaultCellStyle,그것이 셀룰라 스타일을 작성기 창 있는 옵션을 변경하는 글꼴 크기.

그 쉽습니다.

바로 앞으로 접근 방식:

this.dataGridView1.DefaultCellStyle.Font = new Font("Tahoma", 15);

변화에 대한 특정한 하나의 열 글꼴 크기를 사용하여 다음과 같은 문

DataGridView.Columns[1].DefaultCellStyle.Font = new Font("Verdana", 16, FontStyle.Bold);

사용 글꼴 속성이트.MSDN 에 대한 정보와 샘플:

http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.font.aspx

내가 너무 경험이 같은 문제에서 DataGridView 지만 생각하는 DefaultCell 스타일을 상속하는 글꼴의 상자(Datagrid 에 위치한 그룹 상자).그래서 글꼴 변경 상자 변경 DefaultCellStyle too.

감사

1 단계: 이동 형태 datagridview 추가

2 단계: 클릭 datagridview 오른쪽 상단에 표시됩니다 버튼을의 재생과 같은 아이콘이나 화살표를 편집 datagridview.

3 단계: 버튼을 클릭하고 편집을 선택합니다 지금 열을 클릭 속성을 증가하고 싶은 글꼴 크기.

4 단계: 오른쪽에있는 재산의 메뉴 첫 번째 목록에서 열 이름 defaultcellstyle 클릭 속성이 새로운 창이 열립을 변경하는 글꼴 및 글꼴 크기.

내 생각에 그것의 쉬운:

첫째로 설정된 모든 라벨을 다음과 같(이탤릭체,대담하고,크기 등) 고:

yourDataGridView.Font = anyLabel.Font;

가을 디자이너입니다.cs 파일의 형태에 있는 격자를 보고 다음 줄을 주석:- //다.dataGridView1.AlternatingRowsDefaultCellStyle=dataGridViewCellStyle1;

를 사용하는 경우 vs2008..net framework3.5 것으로 기본적으로 적용하는 교류의 행이 있습니다.

'   Cell style
 With .DefaultCellStyle
     .BackColor = Color.Black
     .ForeColor = Color.White 
     .Font = New System.Drawing.Font("Microsoft Sans Serif", 11.0!,
   System.Drawing.FontStyle.Regular,
   System.Drawing.GraphicsUnit.Point, CType(0, Byte))
      .Alignment = DataGridViewContentAlignment.MiddleRight
 End With
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top