tailieunhanh - Manning Windows Forms Programming (phần 8)

Tham khảo tài liệu 'manning windows forms programming (phần 8)', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | .NET Table ListControl class The ListControl class is an abstract class for presenting a collection of objects to the user. You do not normally inherit from this class instead the derived classes ListBox and ComboBox are normally used. This class is part of the namespace and inherits from the Control class. See .NET Table on page 104 for a list of members inherited by this class. Public Properties DataSource DisplayMember SelectedIndex SelectedValue ValueMember Gets or sets the data source for this control. When set the individual items cannot be modified. Gets or sets the property to use when displaying objects in the list control. If none is set or the setting is not a valid property then the ToString property is used. Gets or sets the zero-based index of the object selected in the control. Gets or sets the value of the object selected in the control. Gets or sets the property to use when retrieving the value of an item in the list control. By default the object itself is retrieved. Public Methods GetItemText Returns the text associated with a given item based on the current DisplayMember property setting. Public Events DataSourceChanged DisplayMemberChanged Occurs when the DisplaySource property changes Occurs when the DisplayMember property changes. Let s see how to use some of these members to display the list of photographs contained in an album. The following steps create a new MyAlbumEditor application. We will use this application throughout this chapter to demonstrate how various controls are used. Here we will open an album and display its contents in a ListBox using some of the members inherited from ListControl. 316 chapter 10 List controls Create the MyAlbumEditor project Action Result 1 Create a new project called MyAlbumEditor How-to Use the File menu or the keyboard shortcut Ctrl Shift N. Make sure you close your existing solution if any. The new project appears in the Solution Explorer window with the default Formi .

TỪ KHÓA LIÊN QUAN