Public Class ColoredTextBoxColumnResult
Inherits DataGridTextBoxColumn
Dim passthru As PASSTHRUVARS
Protected Overloads Overrides Sub Paint(ByVal graph As Graphics, _
ByVal rectbounds As Rectangle, ByVal curmngrSrc As _
CurrencyManager, ByVal RowNumber As Integer, ByVal _
ForeColorBrush As Brush, ByVal BackColorBrush As Brush, _
ByVal AlignmentRight As Boolean)
Dim ObjVal As Object
ObjVal = Me.GetColumnValueAtRow(curmngrSrc, RowNumber)
If Not (IsNothing(ObjVal) Or IsDBNull(ObjVal)) Then
If IsNumeric(ObjVal) Then
Dim cellValue As Double = Convert.ToDouble(ObjVal)
If cellValue = 0 Then
BackColorBrush = Brushes.LightGray
ForeColorBrush = Brushes.Black
ElseIf (cellValue > Me.passthru.dblULVrms) Or (cellValue < Me.passthru.dblLLVrms) Then
BackColorBrush = Brushes.Red
ForeColorBrush = Brushes.Black
Else
BackColorBrush = Brushes.Gray
ForeColorBrush = Brushes.Black
End If
Else
BackColorBrush = Brushes.Gray
ForeColorBrush = Brushes.Black
End If
Else
BackColorBrush = Brushes.Gray
ForeColorBrush = Brushes.Black
End If
' Call Paint from the base class to
' accomplish the actual drawing.
MyBase.Paint(graph, rectbounds, curmngrSrc, RowNumber, _
BackColorBrush, ForeColorBrush, AlignmentRight)
End Sub
End Class