如何自定义listbox中每条记录的字体(或背景色)显示颜色

jourmen 2003-12-04 04:23:33
我的程序需要实现如下功能:

.
.
.


listlog.AddItem msg
listlog.ListIndex = listlog.ListCount - 1

'judge errrate
If Mid(msg, 7, 1) = 0 Then 'errrate is serious
'display msg with red color

'这儿的代码如何写?

Call savelog
ElseIf Mid(msg, 7, 1) = 1 Then 'errrate is warning
'display msg with yellow color

'这儿的代码如何写?

Call savelog
End If
...全文
222 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
rainstormmaster 2003-12-04
  • 打赏
  • 举报
回复
http://www.mvps.org/vbnet/index.html?code/subclass/combotabbedlist.htm
rainstormmaster 2003-12-04
  • 打赏
  • 举报
回复
可从
http://www.vbaccelerator.com/home/VB/Code/Controls/Combo_and_List_Boxes/Owner_Draw_Combo_and_List_Box/VB6_Owner_Draw_Combo_List_Full_Source.asp
下载例子

简单点就用LISTVIEW吧
northwolves 2003-12-04
  • 打赏
  • 举报
回复
可以考虑用LISTVIEW代替LISTBOX,代码简单。
TechnoFantasy 2003-12-04
  • 打赏
  • 举报
回复
ListBox本身不支持自定义颜色,你需要通过subclass来实现,参考:
http://www.vbaccelerator.com/home/VB/Code/Controls/Combo_and_List_Boxes/Owner_Draw_Combo_and_List_Box/article.asp

1,451

社区成员

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

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