dbgrideh怎样象foxmail那样已读/未读记录显示不同的小图标,不会用 (50分)

  • 主题发起人 NewLearner
  • 开始时间
N

NewLearner

Unregistered / Unconfirmed
GUEST, unregistred user!
象foxmail那样已读记录显示一个小图标,未读记录显示另一个小图标,不会用dbgrid或dbgrideh怎样实现
 
用DBGridEh,编辑它的字段,看下面的帮助:

A list of bitmaps that will be shown depending of field value and KeyList.
property ImageList: TCustomImageList
Description
To show bitmaps depending on field values. Fill list of values to Column.KeyList property of field values and set Column.ImageList property to ImageList control that have the bitmap in according index. Set Column.NotInKeyListIndex to index of bitmap that will be shown if field's value does not correspond to any value in KeyList (for instance you can set index of image for Null field value). You are not allowed to edit bitmap column. Use blank and mouse click to set next value from Column.KeyList to the field; Shift-blank and Shift-Mouse click to set previous value from Column.KeyList. Set Column.DblClickNextval to True to change value on mouse double click.
You can fill also PickList propery by values of tooltip text. At runtime by moving mouse above image will forces to show text from PickList in tooltips window. Set also Tooltips property to True and ShowHint property of DGBGridEh to True.
 
肯定记录要设个已读标志了
然后在 grid的ondrawcolumncell里写代码,根据已读标志设置显示不同的图标,应该会了吧
 
已/未读字段为isre,在dbgrideh.columns[0].imagelist=imagelist1
那么ondrawcolumncell的代码是否如下:
if dbgrideh.datasource.dataset.fieldbyname('isre').asboolean
then dbgrideh.columns[0]中显示imagelist1的index为1的图标
else dbgrideh.columns[0]中显示imagelist1的index为2的图标;
DBGrideh.DefaultDrawColumnCell(Rect,DataCol,Column,State)
如果是这样,请问具体代码怎样写
 
多人接受答案了。
 
顶部