Datagrid column font change

  • Thread starter Thread starter Steven J. Reed
  • Start date Start date
S

Steven J. Reed

I am attempting to change the font and color on a column
of data within my datagrid. I have included the following
code:

Dim dgtxtLinks As DataGridTextBox
dgcsBrowse = New System.Windows.Forms.DataGridTextBoxColumn
With dgcsBrowse
.Format = ""
.FormatInfo = Nothing
.HeaderText = "Links"
.MappingName = "__Links"
dgtxtLinks = CType(.TextBox, DataGridTextBox)
With dgtxtLinks
.Font = New Drawing.Font(.DefaultFont,
Drawing.FontStyle.Underline)
.ForeColor = Drawing.Color.Blue
End With
.Width = 35
End With
mdgtsBrowse.GridColumnStyles.Add(dgcsBrowse)

The data appears in the default color / font.

Any suggestions?

Thanks...Steve
 
One way you can do this is to derive DataGridTextBoxColumn and override its
Paint method. This FAQ talks about coloring cells, but you can use it to
color columns also.

George Shepherd's Windows Forms FAQ contains an entry entitled:

How do I color a individual cell depending upon its value or some
external method?

Check it out at:
http://www.syncfusion.com/faq/winforms/search/745.asp

=============================================
Clay Burch, .NET MVP

Syncfusion, Inc.
visit http://www.syncfusion.com for .NET Essentials
 
That showed me how to change the color of a cell, but not
how to underline it. I'm still trying to figure that out.
 
Back
Top