1 Attachment(s)
[RESOLVED] DGV formatting
I have a planner with a dgv listing a set of tasks. Everything is a task, but some tasks are designated as meetings based on a bit column named colMeeting. If this column is true, then the task is a meeting/appointment. The bottom 4 tasks meet that criteria and are displayed at the bottom of the list. There is also a query that would display only meeting tasks.
The DGV has general settings that set the forecolor for all of the displayed rows to Black.
Attachment 188079
Code:
#Region "Color Settings"
BackColor = Color.SteelBlue
tlsList.BackColor = Color.LightSteelBlue
tlsList.ForeColor = Color.Black
dgvList.ColumnHeadersDefaultCellStyle.BackColor = Color.LightSteelBlue
dgvList.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black
dgvList.RowsDefaultCellStyle.BackColor = Color.LightSteelBlue
dgvList.BackgroundColor = Color.SteelBlue
dgvList.DefaultCellStyle.BackColor = Color.LightSteelBlue
dgvList.DefaultCellStyle.ForeColor = Color.Black
#End Region
What I would like to do is make the meetings/appointments display to be a different forecolor.
I have attempted a couple of ideas, and failed. I really have no idea at all how one could approach this or even if it is possible.
So my question is can one have specific rows in a DGV with different format settings than other rows in a DGV and how would one go about doing that?
Re: [RESOLVED] DGV formatting
It's probably just the order of operations you're using there...
Code:
If CBool(dgvList.Rows(i).Cells(7).Value) = True Then
'dgvList.Rows(i).Cells(1).Style.ForeColor = Color.DarkRed
dgvList.Rows(i).DefaultCellStyle.ForeColor = Color.DarkRed
'dgvList(1, i).Style.ForeColor = Color.DarkRed
Else
'dgvList(1, i).Style.ForeColor = Color.Black
dgvList.Rows(i).DefaultCellStyle.ForeColor = Color.Black
'dgvList.Rows(i).Cells(1).Style.ForeColor = Color.Black
End If
Try this...
Code:
If CBool(dgvList.Rows(i).Cells(7).Value) = True Then
dgvList.Rows(i).DefaultCellStyle.ForeColor = Color.Black
dgvList.Rows(i).Cells(1).Style.ForeColor = Color.DarkRed
Else
dgvList.Rows(i).DefaultCellStyle.ForeColor = Color.Black
End If