PowerTools InputMan for Windows Forms 8.0J
Items プロパティ (GcComboBox)
使用例 

リストボックスの項目のコレクションを取得します。
構文
Public ReadOnly Property Items As ListItemCollection
public ListItemCollection Items {get;}

プロパティ値

項目のコレクションを表すListItemCollectionオブジェクト。 既定値はNothingです。
解説
このプロパティを使用すると、現在GcComboBoxに格納されている項目のリストへの参照を取得できます。この参照を使用して、コレクション内の項目を追加または削除したり、項目数を確認したりできます。
使用例
複数のカラムに複数のアイテムを表示する GcComboBox コントロールを作成するコード例を次に示します。
//  Please use the following namespace
//  using System.Windows.Forms;
//  using GrapeCity.Win.Editors;

public void SetItemsSettings()
{
    // Creates the GcComboBox control.
    GcComboBox gcComboBox1 = new GcComboBox();

    // Creates the ListListColumns.
    ListColumn listColumn1 = new ListColumn();
    ListColumn listColumn2 = new ListColumn();

    // Createst eh ListItems and SubItems.
    ListItem listItem1 = new ListItem();
    SubItem subItem1 = new SubItem();
    SubItem subItem2 = new SubItem();
    ListItem listItem2 = new ListItem();
    SubItem subItem3 = new SubItem();
    SubItem subItem4 = new SubItem();
    ListItem listItem3 = new ListItem();
    SubItem subItem5 = new SubItem();
    SubItem subItem6 = new SubItem();
    ListItem listItem4 = new ListItem();
    SubItem subItem7 = new SubItem();
    SubItem subItem8 = new SubItem();
    ListItem listItem5 = new ListItem();
    SubItem subItem9 = new SubItem();
    SubItem subItem10 = new SubItem();

    // Sets the ListItems' settings.
    subItem1.Value = "111-1111-1111";
    subItem2.Value = "AAAAA";
    listItem1.SubItems.AddRange(new SubItem[] {
    subItem1,
    subItem2});
    subItem3.Value = "222-2222-2222";
    subItem4.Value = "BBBBB";
    listItem2.SubItems.AddRange(new SubItem[] {
    subItem3,
    subItem4});
    subItem5.Value = "333-3333-3333";
    subItem6.Value = "CCCCC";
    listItem3.SubItems.AddRange(new SubItem[] {
    subItem5,
    subItem6});
    subItem7.Value = "444-4444-4444";
    subItem8.Value = "DDDDD";
    listItem4.SubItems.AddRange(new SubItem[] {
    subItem7,
    subItem8});
    subItem9.Value = "555-5555-5555";
    subItem10.Value = "EEEEE";
    listItem5.SubItems.AddRange(new SubItem[] {
    subItem9,
    subItem10});

    // Adds the columns.
    gcComboBox1.ListColumns.AddRange(new ListColumn[] { listColumn1, listColumn2 });

    // Adds the items.
    gcComboBox1.Items.AddRange(new ListItem[] {
    listItem1,
    listItem2,
    listItem3,
    listItem4,
    listItem5});
}
'  Please use the following namespace
'  Imports System.Windows.Forms;
'  Imports GrapeCity.Win.Editors;

Public Sub SetItemsSettings()
    ' Creates the GcComboBox control.
    Dim gcComboBox1 As New GcComboBox()

    ' Creates the ListListColumns.
    Dim listColumn1 As New ListColumn()
    Dim listColumn2 As New ListColumn()

    ' Createst eh ListItems and SubItems.
    Dim listItem1 As New ListItem()
    Dim subItem1 As New SubItem()
    Dim subItem2 As New SubItem()
    Dim listItem2 As New ListItem()
    Dim subItem3 As New SubItem()
    Dim subItem4 As New SubItem()
    Dim listItem3 As New ListItem()
    Dim subItem5 As New SubItem()
    Dim subItem6 As New SubItem()
    Dim listItem4 As New ListItem()
    Dim subItem7 As New SubItem()
    Dim subItem8 As New SubItem()
    Dim listItem5 As New ListItem()
    Dim subItem9 As New SubItem()
    Dim subItem10 As New SubItem()

    ' Sets the ListItems' settings.
    subItem1.Value = "111-1111-1111"
    subItem2.Value = "AAAAA"
    listItem1.SubItems.AddRange(New SubItem() {subItem1, subItem2})
    subItem3.Value = "222-2222-2222"
    subItem4.Value = "BBBBB"
    listItem2.SubItems.AddRange(New SubItem() {subItem3, subItem4})
    subItem5.Value = "333-3333-3333"
    subItem6.Value = "CCCCC"
    listItem3.SubItems.AddRange(New SubItem() {subItem5, subItem6})
    subItem7.Value = "444-4444-4444"
    subItem8.Value = "DDDDD"
    listItem4.SubItems.AddRange(New SubItem() {subItem7, subItem8})
    subItem9.Value = "555-5555-5555"
    subItem10.Value = "EEEEE"
    listItem5.SubItems.AddRange(New SubItem() {subItem9, subItem10})

    ' Adds the columns.
    gcComboBox1.ListColumns.AddRange(New ListColumn() {listColumn1, listColumn2})

    ' Adds the items.
    gcComboBox1.Items.AddRange(New ListItem() {listItem1, listItem2, listItem3, listItem4, listItem5})
End Sub
参照

GcComboBox クラス
GcComboBox メンバ

 

 


© 2004-2015 GrapeCity inc. All rights reserved.