-5
그림에서 볼 수있는 것처럼 학생 정보 시스템을 만들려고합니다.
ListView의 머리글 및 항목 글꼴이 동일합니다. 머리글 글꼴을 변경하고 싶지만 머리글을 변경하면 항목도 변경됩니다.columnheader 글꼴을 변경하는 방법
그림에서 볼 수있는 것처럼 학생 정보 시스템을 만들려고합니다.
ListView의 머리글 및 항목 글꼴이 동일합니다. 머리글 글꼴을 변경하고 싶지만 머리글을 변경하면 항목도 변경됩니다.columnheader 글꼴을 변경하는 방법
여기 VB.NET에 대한 예입니다.
설정 ListView
True
에 다음 사용하는 다음 코드의 OwnerDraw
-property :
Private Sub ListView1_DrawColumnHeader(ByVal sender As Object, ByVal e As DrawListViewColumnHeaderEventArgs) Handles ListView1.DrawColumnHeader
Dim strFormat As New StringFormat()
If e.Header.TextAlign = HorizontalAlignment.Center Then
strFormat.Alignment = StringAlignment.Center
ElseIf e.Header.TextAlign = HorizontalAlignment.Right Then
strFormat.Alignment = StringAlignment.Far
End If
e.DrawBackground()
e.Graphics.FillRectangle(Brushes.SteelBlue, e.Bounds)
Dim headerFont As New Font("Arial", 8, FontStyle.Bold)
e.Graphics.DrawString(e.Header.Text, headerFont, Brushes.White, e.Bounds, strFormat)
End Sub
Private Sub ListView1_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawListViewItemEventArgs) Handles ListView1.DrawItem
e.DrawDefault = True
End Sub
덕분에 나의 영웅 :) –