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

リストボックスのカラムのコレクションを取得します。
構文
Public ReadOnly Property ListColumns As ListColumnCollection
public ListColumnCollection ListColumns {get;}

プロパティ値

カラムのコレクションを表すListColumnCollectionオブジェクト。
解説
このプロパティによって返されたListColumnCollectionを使用することで、GcComboBoxコントロールのドロップダウンリストに含まれる列を追加または削除したり、列数を確認したりできます。
使用例
カラムスタイルの既定値を設定した GcComboBox コントロールを作成するコード例を次に示します。カラムが追加された時には、既定値のスタイルが設定されます。この例では他に ListColumns and ListDefaultColumn プロパティを使用しています。
//  Please use the following namespace
//  using System.Windows.Forms;
//  using System.Drawing;
//  using GrapeCity.Win.Editors;

public void SetListColumns()
{
    // Creates the GcComboBox 
    GcComboBox gcComboBox1 = new GcComboBox();
    // Sets the DefaultListItem settings.
    gcComboBox1.ListDefaultColumn.AutoWidth = true;
    gcComboBox1.ListDefaultColumn.Header.ContentAlignment = ContentAlignment.MiddleCenter;
    // Creates a GradientEffect object.
    GradientEffect gradienteffect = new GradientEffect();
    gradienteffect.Direction = GradientDirection.Side;
    gradienteffect.EndColor = Color.FromArgb(224, 224, 224);
    gcComboBox1.ListDefaultColumn.Header.GradientEffect = gradienteffect;
    gcComboBox1.ListDefaultColumn.Header.TextEffect = TextEffect.RaisedLite;
    gcComboBox1.ListDefaultColumn.DefaultSubItem.ContentAlignment = ContentAlignment.MiddleCenter;
    gcComboBox1.ListDefaultColumn.DefaultSubItem.Padding = new Padding(2, 2, 2, 2);
    gcComboBox1.ListDefaultColumn.DefaultSubItem.WordWrap = false;

    // The column1 and the column2 inherits the settings of the DefaultListColumn
    ListColumn column1 = new ListColumn();
    ListColumn column2 = new ListColumn();
    // The column3 overwrites some properties for advanced settings.
    ListColumn column3 = new ListColumn();
    column3.AutoWidth = false;
    column3.DataDisplayType = DataDisplayType.Image;
    column3.Header.AllowResize = true;
    column3.Header.Clickable = true;
    column3.Header.Image = new Bitmap(@"C:\ColumnHeader.jpg");
    column3.Header.TextAttachAlignment = AttachAlignment.RightMiddle;

    gcComboBox1.ListColumns.AddRange(new ListColumn[] { column1, column2, column3 });
}
'  Please use the following namespace
'  Imports System.Windows.Forms;
'  Imports System.Drawing;
'  Imports GrapeCity.Win.Editors;

Public Sub SetListColumns()
    ' Creates the GcComboBox 
    Dim gcComboBox1 As New GcComboBox()
    ' Sets the DefaultListItem settings.
    gcComboBox1.ListDefaultColumn.AutoWidth = True
    gcComboBox1.ListDefaultColumn.Header.ContentAlignment = ContentAlignment.MiddleCenter
    ' Creates a GradientEffect object.
    Dim gradienteffect As New GradientEffect()
    gradienteffect.Direction = GradientDirection.Side
    gradienteffect.EndColor = Color.FromArgb(224, 224, 224)
    gcComboBox1.ListDefaultColumn.Header.GradientEffect = gradienteffect
    gcComboBox1.ListDefaultColumn.Header.TextEffect = TextEffect.RaisedLite
    gcComboBox1.ListDefaultColumn.DefaultSubItem.ContentAlignment = ContentAlignment.MiddleCenter
    gcComboBox1.ListDefaultColumn.DefaultSubItem.Padding = New Padding(2, 2, 2, 2)
    gcComboBox1.ListDefaultColumn.DefaultSubItem.WordWrap = False

    ' The column1 and the column2 inherits the settings of the DefaultListColumn
    Dim column1 As New ListColumn()
    Dim column2 As New ListColumn()
    ' The column3 overwrites some properties for advanced settings.
    Dim column3 As New ListColumn()
    column3.AutoWidth = False
    column3.DataDisplayType = DataDisplayType.Image
    column3.Header.AllowResize = True
    column3.Header.Clickable = True
    column3.Header.Image = New Bitmap("C:\ColumnHeader.jpg")
    column3.Header.TextAttachAlignment = AttachAlignment.RightMiddle

    gcComboBox1.ListColumns.AddRange(New ListColumn() {column1, column2, column3})
End Sub
参照

GcComboBox クラス
GcComboBox メンバ
ListDefaultColumn プロパティ

 

 


© 2004-2015 GrapeCity inc. All rights reserved.