列表视图中的按钮 [英] Buttons in a listview

查看:78
本文介绍了列表视图中的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发一个音乐播放器应用程序,我将所有专辑和艺术家分类到ListView中,其方式与Windows Media Player中的相似。但现在我不知道如何设置歌曲标题到相应专辑的右侧,并使它们可以点击。

所以......有可能吗?



提前致谢



PD:我不是英国人,所以请对不起我的问题中的任何误解



我尝试了什么:



我试图通过按钮完成此操作,但是我无法将它们放入ListView ...

解决方案

另一种方法是使用带有Button列的DataGridView:

 DataGridViewButtonColumn dgvButton = new DataGridViewButtonColumn(); 



请参阅: C#Corner:错误显示 [ ^ ]

你没有提到你是否使用 WinForms WPF ,但如果是WinForms然后看看这些CodeProject文章:

ImageListView [ ^ ]

列表视图中的嵌入控件 [ ^ ]

列表和组合框控件的扩展(继承)版本 [ ^ ]


I'm trying to develop a music player app, and I have all albums and artists sorted in a ListView, in a very similar way to the one in Windows Media Player. But now I don't know what to do to set song titles to the right of their corresponding albums, and making them clickable.
So... Is it possible?

Thanks in advance

P.D.: I'm not English, so please sorry for any misunderstanding in my questions

What I have tried:

I've tried to accomplish this with buttons, but I can't place them INTO the ListView...

解决方案

An alternative is using a DataGridView with a Button column:

DataGridViewButtonColumn dgvButton = new DataGridViewButtonColumn();


See: C# Corner : Error Display[^]


You did not mention if you use WinForms or WPF, but if it is WinForms then take a look at these CodeProject articles:
ImageListView[^]
Embedding Controls in a ListView[^]
Extended (Inherited) Versions of List and Combo Box Controls[^]


这篇关于列表视图中的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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