Public Class DataGridColoredTextBoxColumn
Inherits DataGridTextBoxColumn
Private m_BackColor As Color = Color.White
Private m_ForeColor As Color = Color.Black
Public Event GetColors(ByVal rownum As Integer, ByRef bBack As Color, ByRef bFore As Color)
Property BackColor() As Color
Get
Return m_BackColor
End Get
Set(ByVal Value As Color)
m_BackColor = Value
End Set
End Property
Property ForeColor() As Color
Get
Return m_ForeColor
End Get
Set(ByVal Value As Color)
m_ForeColor = Value
End Set
End Property
Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal r As Rectangle, ByVal cm As CurrencyManager, ByVal rownum As Integer)
Dim b As Color = BackColor
Dim f As Color = ForeColor
RaiseEvent GetColors(rownum, b, f)
Call MyBase.Paint(g, r, cm, rownum, New SolidBrush(b), New SolidBrush(f), False)
End Sub
Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal r As Rectangle, ByVal cm As CurrencyManager, ByVal rownum As Integer, ByVal bAlignRight As Boolean)
Dim b As Color = BackColor
Dim f As Color = ForeColor
RaiseEvent GetColors(rownum, b, f)
Call MyBase.Paint(g, r, cm, rownum, New SolidBrush(b), New SolidBrush(f), bAlignRight)
End Sub
Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal r As Rectangle, ByVal cm As CurrencyManager, ByVal rownum As Integer, ByVal bBack As Brush, ByVal bFore As Brush, ByVal bAlignRight As Boolean)
Dim b As Color = BackColor
Dim f As Color = ForeColor
RaiseEvent GetColors(rownum, b, f)
Call MyBase.Paint(g, r, cm, rownum, New SolidBrush(b), New SolidBrush(f), bAlignRight)
End Sub