all groups > vb.net > february 2006 >
You're in the

vb.net

group:

DataGridView: dynamic font size change



DataGridView: dynamic font size change Lennart Nielsen
2/5/2006 3:47:00 PM
vb.net: How do you change the font size dynamically in a single selected cell?

Lennart

Re: DataGridView: dynamic font size change Ken Tucker [MVP]
2/6/2006 7:08:09 AM
Hi,

Try changing the cell style's font in the cell paint event.

Private Sub DataGridView1_CellPainting(ByVal sender As Object, ByVal e
As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles
DataGridView1.CellPainting
Try
If DataGridView1.Item(e.ColumnIndex, e.RowIndex).Selected Then
e.CellStyle.Font = New Font(Me.Font, FontStyle.Bold)
Else
e.CellStyle.Font = New Font(Me.Font, FontStyle.Regular)
End If
Catch
End Try

End Sub

Ken
----------------
[quoted text, click to view]

AddThis Social Bookmark Button