trueDBGrid中如何设置某行的颜色,譬如符合某种条件的则置为红色,求帮助,急!!!

iamlobster 2008-11-01 10:41:06
如题
...全文
121 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
aohan 2008-11-20
  • 打赏
  • 举报
回复
Dim NegativeStyle As New TrueDBGrid80.Style

' 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

TDBGrid1.HighlightRowStyle.BackColor = &H400000
TDBGrid1.HighlightRowStyle.ForeColor = vbWhite
TDBGrid1.AlternatingRowStyle = True
zuoxingyu 2008-11-20
  • 打赏
  • 举报
回复
http://topic.csdn.net/t/20020703/01/845423.html
tongnaifu 2008-11-02
  • 打赏
  • 举报
回复
mark

1,453

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧