Displaying ListView items - with class! by Rob Birdwell
p;
}
Your form requires you to display the Name, Rank, and SerialNumber members of each Person object in a ListView. We will now create a sub-class of the ListItem base class: "PersonListItem" class. This doesn't involve much code, and the pay-off will be cleaner code and greater flexibility if your display and/or design changes:
// Provide easy access to the Person class within a ListView
class PersonListItem : ListItem
{
private Person m_Person;
public PersonListItem (Person person) : base()
&n
}
Your form requires you to display the Name, Rank, and SerialNumber members of each Person object in a ListView. We will now create a sub-class of the ListItem base class: "PersonListItem" class. This doesn't involve much code, and the pay-off will be cleaner code and greater flexibility if your display and/or design changes:
// Provide easy access to the Person class within a ListView
class PersonListItem : ListItem
{
private Person m_Person;
public PersonListItem (Person person) : base()
&n
| 对此文章发表了评论 |

