Public Sub New(ByVal left As Boolean, ByVal right As Boolean)
'constructor
drawLeft = left
drawRight = right
End Sub
'**other subs that REQUIRE to be overridden
'** are included in the class but they don't do much so
'** i've not bothered to include them here
Protected Overloads Overrides Sub Paint(ByVal g As _
System.Drawing.Graphics, ByVal bounds As _
System.Drawing.Rectangle, ByVal source As _
System.Windows.Forms.CurrencyManager, ByVal rowNum As _
Integer)
Paint(g, bounds, source, rowNum)
End Sub
Protected Overloads Overrides Sub Paint(ByVal g As _
System.Drawing.Graphics, ByVal bounds As _
System.Drawing.Rectangle, ByVal source As _
System.Windows.Forms.CurrencyManager, ByVal rowNum As _
Integer, ByVal alignToRight As Boolean)
Paint(g, bounds, source, rowNum, alignToRight)
End Sub
Protected Overloads Overrides Sub Paint(ByVal g As _
System.Drawing.Graphics, ByVal bounds As _
System.Drawing.Rectangle, ByVal source As _
System.Windows.Forms.CurrencyManager, ByVal rowNum As _
Integer, ByVal BackBrush As Brush, ByVal ForeBrush As Brush, _
ByVal AlignToRight As Boolean)
'pen
Dim p As Pen = New Pen(Color.Black)
'font
Dim font As Font = New System.Drawing.Font("Arial", 9)
'string
Dim str As String
'coordinates used for drawing lines
'(origin points)
Dim x1 As Single
Dim y1 As Single
'set start coordinates
x1 = bounds.Location.X
y1 = bounds.Location.Y
g.FillRectangle(BackBrush, bounds)
'draw the horizontal line
g.DrawLine(p, x1, y1, x1 + bounds.Width, y1)
'draw vertical line on left if flag set
If drawLeft = True Then
g.DrawLine(p, x1, y1, x1, y1 + bounds.Height)
End If
'draw vertical line on right if flag set
If drawRight = True Then
g.DrawLine(p, x1 + bounds.Width, y1, x1 + bounds.Width, y1 + bounds.Height)
End If
str = GetColumnValueATrow(source, rowNum)
'draw the text
g.DrawString(str, font, Brushes.Black, bounds.X, bounds.Y)
End Sub