W
WStoreyII
I downloaded this tutorial from the msdn? @
http://msdn.microsoft.com/library/d...tingWindowsFormsDataGridVisualBasicPrimer.asp
Now my question though is on this sub:
Public Class ColoredTextBoxColumn
Inherits DataGridTextBoxColumn
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
Dim cellValue As Integer
cellValue = CType(ObjVal, Integer)
If (cellValue > 1) Then
' Here is where we are going to do
' the actual painting.
' Color the contents of the cell Red
' and the background of the cell Yellow.
BackColorBrush = Brushes.Yellow
ForeColorBrush = Brushes.Red
Else
BackColorBrush = Brushes.White
ForeColorBrush = Brushes.Black
End If
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
What confuses me is that this code runs with out even being called. I have
racked this code all day and can not figure out why it does that or how i
can mimick it
i also dont understand how this code works on all the cells in the grids. i
have not seen an loops in this code at all yet it works ???
WStoreyII
http://msdn.microsoft.com/library/d...tingWindowsFormsDataGridVisualBasicPrimer.asp
Now my question though is on this sub:
Public Class ColoredTextBoxColumn
Inherits DataGridTextBoxColumn
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
Dim cellValue As Integer
cellValue = CType(ObjVal, Integer)
If (cellValue > 1) Then
' Here is where we are going to do
' the actual painting.
' Color the contents of the cell Red
' and the background of the cell Yellow.
BackColorBrush = Brushes.Yellow
ForeColorBrush = Brushes.Red
Else
BackColorBrush = Brushes.White
ForeColorBrush = Brushes.Black
End If
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
What confuses me is that this code runs with out even being called. I have
racked this code all day and can not figure out why it does that or how i
can mimick it
i also dont understand how this code works on all the cells in the grids. i
have not seen an loops in this code at all yet it works ???
WStoreyII