By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,723 Members | 1,095 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,723 IT Pros & Developers. It's quick & easy.

DataGridView: dynamic font size change

P: n/a
How do you change the font size dynamically in a single selected cell?

Lennart
Feb 5 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.DataGridViewCellPaintingEvent Args) 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
----------------
"Lennart Nielsen" <ln******@uni-systems.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
How do you change the font size dynamically in a single selected cell?

Lennart

Feb 6 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.