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

入力用フィールドのコレクションを取得します。
構文
Public ReadOnly Property Fields As MaskFieldCollection
public MaskFieldCollection Fields {get;}

プロパティ値

入力用フィールドのコレクションを表す GrapeCity.Win.Editors.Fields.MaskFieldCollection
解説
このプロパティは、コントロールの書式を設定するフィールドオブジェクトのコレクションを参照します。
使用例
入力を自動変換しないGcMaskedComboBoxコントロールを作成するコード例を次に示します。この例では他にAutoConvertDefaultActiveFieldFieldsプロパティを使用して、特定の文字の入力を許可するGcMaskedComboBoxコントロールを作成しています。
'  Please use the following namespace
'  Imports System.Windows.Forms;
'  Imports GrapeCity.Win.Editors;

Public Sub SetFieldsSettings()
    ' Creates an instance of a GcMaskedComboBox control.
    Dim gcMaskedComboBox1 As New GcMaskedComboBox()
    ' Creates some fields.
    Dim maskLiteralField1 As New GrapeCity.Win.Editors.Fields.MaskLiteralField()
    Dim maskPatternField1 As New GrapeCity.Win.Editors.Fields.MaskPatternField()
    Dim maskLiteralField2 As New GrapeCity.Win.Editors.Fields.MaskLiteralField()
    Dim maskPatternField2 As New GrapeCity.Win.Editors.Fields.MaskPatternField()

    ' Sets the fields' settings.
    maskLiteralField1.Text = "TEL:"
    maskPatternField1.MaxLength = 4
    maskPatternField1.MinLength = 4
    maskPatternField1.Pattern = "\D"
    maskLiteralField2.Text = "-"
    maskPatternField2.MaxLength = 4
    maskPatternField2.MinLength = 4
    maskPatternField2.Pattern = "\D"

    ' Adds fields to the GcMaskedComboBox control.
    gcMaskedComboBox1.Fields.AddRange(New GrapeCity.Win.Editors.Fields.MaskField() {maskLiteralField1, maskPatternField1, maskLiteralField2, maskPatternField2})

    ' Sets the AutoConvert to false in order to not accept invalid chars.
    gcMaskedComboBox1.AutoConvert = False

    ' Sets the DefaultActiveField to the first pattern field for inputing.
    gcMaskedComboBox1.DefaultActiveField = maskPatternField1
End Sub

'
' This method is equivalent to the method "SetFieldsSettings()" above.
'
Public Sub SetFieldsByPatternString()
    Dim gcMaskedComboBox1 As New GcMaskedComboBox()

    ' Create fields by pattern string.
    gcMaskedComboBox1.Fields.AddRange("TEL\D{4}-\D{4}")

    ' Sets the AutoConvert to false in order to not accept invalid chars.
    gcMaskedComboBox1.AutoConvert = False

    ' Sets the first MaskPatternField instance as the default active field.
    gcMaskedComboBox1.DefaultActiveField = gcMaskedComboBox1.Fields.Find(Of GrapeCity.Win.Editors.Fields.MaskPatternField)()
End Sub
//  Please use the following namespace
//  using System.Windows.Forms;
//  using GrapeCity.Win.Editors;

public void SetFieldsSettings()
{
    // Creates an instance of a GcMaskedComboBox control.
    GcMaskedComboBox gcMaskedComboBox1 = new GcMaskedComboBox();
    // Creates some fields.
    GrapeCity.Win.Editors.Fields.MaskLiteralField maskLiteralField1 = new GrapeCity.Win.Editors.Fields.MaskLiteralField();
    GrapeCity.Win.Editors.Fields.MaskPatternField maskPatternField1 = new GrapeCity.Win.Editors.Fields.MaskPatternField();
    GrapeCity.Win.Editors.Fields.MaskLiteralField maskLiteralField2 = new GrapeCity.Win.Editors.Fields.MaskLiteralField();
    GrapeCity.Win.Editors.Fields.MaskPatternField maskPatternField2 = new GrapeCity.Win.Editors.Fields.MaskPatternField();

    // Sets the fields' settings.
    maskLiteralField1.Text = "TEL:";
    maskPatternField1.MaxLength = 4;
    maskPatternField1.MinLength = 4;
    maskPatternField1.Pattern = "\\D";
    maskLiteralField2.Text = "-";
    maskPatternField2.MaxLength = 4;
    maskPatternField2.MinLength = 4;
    maskPatternField2.Pattern = "\\D";

    // Adds fields to the GcMaskedComboBox control.
    gcMaskedComboBox1.Fields.AddRange(new GrapeCity.Win.Editors.Fields.MaskField[] {
    maskLiteralField1,
    maskPatternField1,
    maskLiteralField2,
    maskPatternField2});

    // Sets the AutoConvert to false in order to not accept invalid chars.
    gcMaskedComboBox1.AutoConvert = false;

    // Sets the DefaultActiveField to the first pattern field for inputing.
    gcMaskedComboBox1.DefaultActiveField = maskPatternField1;
}

//
// This method is equivalent to the method "SetFieldsSettings()" above.
//
public void SetFieldsByPatternString()
{
    GcMaskedComboBox gcMaskedComboBox1 = new GcMaskedComboBox();

    // Create fields by pattern string.
    gcMaskedComboBox1.Fields.AddRange(@"TEL\D{4}-\D{4}");

    // Sets the AutoConvert to false in order to not accept invalid chars.
    gcMaskedComboBox1.AutoConvert = false;

    // Sets the first MaskPatternField instance as the default active field.
    gcMaskedComboBox1.DefaultActiveField = gcMaskedComboBox1.Fields.Find<GrapeCity.Win.Editors.Fields.MaskPatternField>();
}
参照

GcMaskedComboBox クラス
GcMaskedComboBox メンバ

 

 


© 2004-2015 GrapeCity inc. All rights reserved.