' Set the database property of the data control
dbDir = App.Path
Data1.DatabaseName = dbDir + "\genledgr.mdb"
Data1.RecordSource = "Select * From Accounts Order By AccountID"
Data1.Refresh
' In the leftmost split, set the general ledger number
' so that any value which contains solely numbers (no
' decimals) will appear in boldface
Dim S As New TrueDBGrid80.Style
S.Font.Bold = True
S.Font.Name = "Tahoma"
TDBGrid1.Columns(0).AddRegexCellStyle 0, S, "^[0-9]+$"
TDBGrid1.Columns(0).AddRegexCellStyle 1, S, "^[0-9]+$"
'In the Running total column set any number that appears to
'be negative with a ForeColor of red
NegativeStyle.ForeColor = vbRed '这里显示红色
TDBGrid1.Splits(2).Columns(7).AddRegexCellStyle 0, NegativeStyle, "^(.+)$"
TDBGrid1.Splits(2).Columns(7).AddRegexCellStyle 0, NegativeStyle, "^ *-"
'Set the colors for the even and odd rows
TDBGrid1.EvenRowStyle.BackColor = &H80FFFF
TDBGrid1.OddRowStyle.BackColor = &HC0FFFF