CheckedListBox中的项目是否有标记?或类似的东西?我希望能够存储与我正在显示的项目相关联的ID. 您可以从CheckedListBox继承自己的控件并创建一个属性,在C#中它就像这样,其余的功能保持
public class MyCheckedListbox : System.Windows.Forms.CheckedListBox{ private object thisObj; public object Tag{ get{ return this.thisObj; } set{ this.thisObj = value; } } }
编辑:决定包括VB.NET版本,也为每个人的利益…
Public Class MyCheckedListBox Inherits System.Windows.Forms.CheckedListBox Private thisObj As Object Public Property Tag As Object Get Tag = thisObj End Get Set (objParam As Object) thisObj = objParam End Set End Property End Class
当然,这很简单,使用拳击,但很好地工作…
希望这可以帮助