Hm, I didn't find this. Although I guess it must be possible by using the
Paint-event of the DataGrid.
I used this function to write something to some row-headers. I guess the
same must be possible with the column-headers:
Private Sub dbgFolder_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles dbgFolder.Paint
Dim row As Integer
row = TopRow()
Dim yDelta As Integer
If row >= 0 Then
yDelta = (dbgFolder.GetCellBounds(row, 0).Height + 1)
Dim y As Integer
y = (dbgFolder.GetCellBounds(row, 0).Top + 2)
Dim cm As CurrencyManager
cm = CType(Me.BindingContext(dbgFolder.DataSource,
dbgFolder.DataMember), CurrencyManager)
Dim dtvGrid As DataView
dtvGrid = New DataView(dtblGrid)
'5 omdat em anders de onderste telkens ni tekende...
Do While ((y < (dbgFolder.Height - yDelta + 3)) AndAlso (row <
cm.Count))
'get & draw the header text...
If DateDiff(DateInterval.Hour,
dtvGrid.Item(row).Item("DateFile"), Now) <= 12 Then
Dim text1 As String
' text1 = System.String.Format("row{0}", row)
text1 = System.String.Format("N", row)
e.Graphics.DrawString(text1, dbgFolder.Font, New
SolidBrush(Color.Black), 4, y)
End If
y = (y + yDelta)
row = (row + 1)
Loop
End If
End Sub
Or maybe override the Paint-event of the cell (I guess that's better, hehe),
and than use
g.FillRectangle(e.BackBrush, bounds)
But to be hon,nest I'm not really an expert of these things. I did some
stuff in it to extend the datagrid, but that's all :-)
Hope this helps,
Pieter
<(E-Mail Removed)> wrote in message
news:556301c40049$f2441fe0$(E-Mail Removed)...
> This was helpful, thanks. But to add to the question, I
> want to be able to set different colors for the column
> header cells also and I don't think the tips cover this.
> Any ideas?
>
> >-----Original Message-----
> >http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp
> >you can find it there + a lot of other nice tips
> >
> >Pieter
> >
> >"PJ" <(E-Mail Removed)> wrote in message
> >news:58c001c40037$59e6dd80$(E-Mail Removed)...
> >> How can you set the background color of individual
> >> columns in a datagrid to be different to others? The
> >> table styles only allow you to do this at the grid
> level
> >> for all columns.
> >
> >
> >.
> >