如何在vb.net 2005中的列表框中加粗某些特定项目 [英] How to bold some specific item in list box in vb.net 2005

查看:80
本文介绍了如何在vb.net 2005中的列表框中加粗某些特定项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我不知道如何在VB.net中以粗体显示列表框(表单列表框)中的特定项目
请帮帮我.

预先感谢,
Karthikesan

Hi,
i dont know how to bold a specific item in list box(Forms List Box) as bold in VB.net
Please help me out.

Thanks in advance,
Karthikesan

推荐答案

您可以在WPF中轻松完成此操作,因为每个ListItem都可以获取任何Content,并且可以是任何类型,而不仅是ListItem.特别是,您可以将TextBlock用于Content,因此TextBlock的每个实例在列表框的不同项目中都可以使用不同的字体.

System.Windows.Forms.ListBox并非如此.项也可以是任何类型,但是它们以相同的方式呈现.您在屏幕上的项目中看到的内容将呈现为方法object.ToString返回的值.该字符串始终使用相同的字体呈现,该字体是类ListBox的实例的属性.完整列表,而不是单个项目.就我所知,关于ASP.NET System.Web.UI.WebControls.ListBox也是一样.

您可以在我的大多数CodeProject文章中找到具有WPF列表视图和单个列表项属性的代码示例(最后一篇除外).

—SA
You can easily do it in WPF, as each ListItem can get any Content and can be any type, not only ListItem. In particular, you can use TextBlock for Content, so each instance of the TextBlock can get different font in different items of the list box.

This is not the case with System.Windows.Forms.ListBox. Items can also be of any type, but they are rendered in the same way. What you see in the item on screen is rendered as the value returned by the method object.ToString. This string is always rendered with the same font which is the property of an instance of the class ListBox. A whole list, not individual item. Same thing about ASP.NET, System.Web.UI.WebControls.ListBox, to best of my knowledge.

You can find find the code samples with WPF list views and individual list item properties in most of my CodeProject articles (except the last one).

—SA


这篇关于如何在vb.net 2005中的列表框中加粗某些特定项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆