帮助...用C#中的列表框..? [英] Help...with listbox in c#..?

查看:66
本文介绍了帮助...用C#中的列表框..?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在任何列表框中插入序号....

例如,我有一个包含以下数据的列表框:

ListBox1
罗纳尔多
梅西
戈麦斯
里贝里

现在我想在列表框中输入序数,例如:
1.罗纳尔多
2.梅西
3.戈麦斯
4.Ribery

How can I insert Ordinal number i any listbox....

ex I have a listbox with these data:

ListBox1
Ronaldo
Mesi
Gomes
Ribery

and now I want to have ordinal number in a listbox like:
1.Ronaldo
2.Mesi
3.Gomes
4.Ribery

推荐答案

您可以使用 OwnerDraw列表框版本.
You can use DataSource property, so you can have a field do be displayed and a field to be used as value of the selected element(s). You only have to add you elements as shown in the sample.
Or, you might create an OwnerDraw listbox version.


这篇关于帮助...用C#中的列表框..?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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