GrapeCity.Win.Editors.v80 アセンブリ > GrapeCity.Win.Editors 名前空間 > GcMaskedComboBox クラス : AutoConvert プロパティ |
DBCSマスク入力フィールドにSBCSを入力すると、入力された文字は自動的にDBCSに変換されます。また、コントロールでSBCSのみが許可されている場合には、DBCSのスペースは自動的にSBCSのスペースに変換されます。
' 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>(); }