devexpress xtragrid 删除样式
dev express xtra grid removes styling
我有一个 XtraGrid 类型的传入电子邮件网格。
我有一个名为 "isRead" 的列,它是布尔类型。
Private Sub IsReadEmails_BoldFont()
'This Sub checks all data and if their column "IsRead" is equal to 0 then will make all this rows font Bold.
Dim IsRead As Boolean
For i As Integer = 0 To gridvwIncEmailsList.RowCount
IsRead = gridvwIncEmailsList.GetRowCellValue(i, gridvwIncEmailsList.Columns(13))
If Not (IsRead) Then
gridvwIncEmailsList.SelectRow(i)
gridvwIncEmailsList.Appearance.SelectedRow.BackColor = Color.White
gridvwIncEmailsList.Appearance.SelectedRow.Font = New Font("Tahoma", 10.0F, FontStyle.Bold)
gridvwIncEmailsList.Appearance.SelectedRow.ForeColor = Color.Black
End If
Next
End Sub
这就是我的传入电子邮件样式的网格。
乍一看我的代码有效,无论何时我的表单加载我的样式都是正确的。
一旦我在网格内单击,所有粗体项目都会恢复正常!!
好像它做了某种刷新。
没有监听点击事件的事件。
为什么会这样?
您还有什么建议吗?
尝试 XtraGrid 的 RowStyle 事件:DevExpress Custom Grid Styles
Private Sub gridvwIncEmailsList_RowStyle(ByVal sender As Object,
ByVal e As RowStyleEventArgs) Handles gridvwIncEmailsList.RowStyle
Dim View As GridView = TryCast(sender, GridView)
If e.RowHandle >= 0 Then
Dim IsRead As String = View.GetRowCellDisplayText(e.RowHandle, View.Columns("IsRead"))
If IsRead = "Unchecked" Then
e.Appearance.BackColor = Color.FromArgb(150, Color.LightCoral)
e.Appearance.BackColor2 = Color.White
e.Appearance.BackColor = Color.White
e.Appearance.Font = New Font("Tahoma", 10.0F, FontStyle.Bold)
e.Appearance.ForeColor = Color.Black
End If
End If
End Sub
我有一个 XtraGrid 类型的传入电子邮件网格。 我有一个名为 "isRead" 的列,它是布尔类型。
Private Sub IsReadEmails_BoldFont()
'This Sub checks all data and if their column "IsRead" is equal to 0 then will make all this rows font Bold.
Dim IsRead As Boolean
For i As Integer = 0 To gridvwIncEmailsList.RowCount
IsRead = gridvwIncEmailsList.GetRowCellValue(i, gridvwIncEmailsList.Columns(13))
If Not (IsRead) Then
gridvwIncEmailsList.SelectRow(i)
gridvwIncEmailsList.Appearance.SelectedRow.BackColor = Color.White
gridvwIncEmailsList.Appearance.SelectedRow.Font = New Font("Tahoma", 10.0F, FontStyle.Bold)
gridvwIncEmailsList.Appearance.SelectedRow.ForeColor = Color.Black
End If
Next
End Sub
这就是我的传入电子邮件样式的网格。 乍一看我的代码有效,无论何时我的表单加载我的样式都是正确的。
一旦我在网格内单击,所有粗体项目都会恢复正常!! 好像它做了某种刷新。 没有监听点击事件的事件。
为什么会这样? 您还有什么建议吗?
尝试 XtraGrid 的 RowStyle 事件:DevExpress Custom Grid Styles
Private Sub gridvwIncEmailsList_RowStyle(ByVal sender As Object,
ByVal e As RowStyleEventArgs) Handles gridvwIncEmailsList.RowStyle
Dim View As GridView = TryCast(sender, GridView)
If e.RowHandle >= 0 Then
Dim IsRead As String = View.GetRowCellDisplayText(e.RowHandle, View.Columns("IsRead"))
If IsRead = "Unchecked" Then
e.Appearance.BackColor = Color.FromArgb(150, Color.LightCoral)
e.Appearance.BackColor2 = Color.White
e.Appearance.BackColor = Color.White
e.Appearance.Font = New Font("Tahoma", 10.0F, FontStyle.Bold)
e.Appearance.ForeColor = Color.Black
End If
End If
End Sub