| GrapeCity.Win.Editors.v80 アセンブリ > GrapeCity.Win.Editors 名前空間 > GcTextBox クラス : Format プロパティ |
以下のキーワードを組み合わせた文字列を指定します。全角文字が指定された場合は全角文字が、半角文字が指定された場合は 半角文字がそれぞれ入力可能な文字種として指定されます。
| 全角 | 半角 | 説明 |
|---|---|---|
| A | A | 大文字のアルファベット(A〜Z) |
| a | a | 小文字のアルファベット(a〜z) |
| K | K | カタカナ(促音・拗音の小書き表記あり) |
| N | N | カタカナ(促音・拗音の小書き表記なし) |
| 9 | 9 | 数字(0〜9) |
| # | # | 数字および数字関連記号(0〜9、+ - $ % \ , .) |
| @ | @ | 記号 |
| B | B | 2進数(0または1) |
| X | X | 16進数(0〜9、A〜F、a-f) |
| S | S | 空白文字 |
| J | - | ひらがな(促音・拗音の小書き表記あり) |
| G | - | ひらがな(促音・拗音の小書き表記なし) |
| Z | - | すべての全角文字 |
| T | - | サロゲート ペア文字 |
| D | - | 2バイト文字(サロゲート ペア文字を除いた全角文字) |
| I | - | JIS X 0208文字で構成された文字 |
| M | - | Shift JIS文字で構成された文字 |
| V | - | IVS(Ideographic Variation Sequence)文字 |
| - | H | すべての半角文字 |
| - | ^ | 指定した書式に含まれないすべての文字 |
| - | \ | エスケープ・シーケンス |
Format プロパティで設定した以外の文字種が入力されたときは、 InvalidInput イベントが発生します。
また、テキストコントロールへの入力を制御するために、Format プロパティのほかに次のプロパティが用意されています。
Text プロパティに渡す文字列は、 Format プロパティで設定した入力マスクと正確に一致する必要があります。 一致しない場合には、キーボードで入力した内容またはコードで設定した内容は、 Text プロパティに反映されません。 ただし、AutoConvert プロパティによって自動修正が可能な場合は除きます。 また、Format プロパティを変更すると、Text プロパティは自動的に空の文字列に設定されます。
// Please use the following namespace // using System.Windows.Forms; // using GrapeCity.Win.Editors; public void InitializeTextBox() { // Create an instance of a GcTextBox control. GcTextBox gcTextBox1 = new GcTextBox(); // Allow the GcTextBox control to accept only upper case alphabet(A-Z) and SBCS space. gcTextBox1.Format = "AS"; // The GcTextBox control will not try to convert invalid char to valid char automatically. gcTextBox1.AutoConvert = false; // Create an instance of a GcTextBox control. GcTextBox gcTextBox2 = new GcTextBox(); // Accept upper and lower case alphabet, as well as the symbols. Except '#', '@' and '*' chars. gcTextBox2.Format = @"aA@^\#\@*"; // The GcTextBox will try to convert the invalid char to valid char automatically. gcTextBox2.AutoConvert = true; }
' Please use the following namespace ' Imports System.Windows.Forms ' Imports GrapeCity.Win.Editors Public Sub InitializeTextBox() ' Create an instance of a GcTextBox control. Dim gcTextBox1 As New GcTextBox() ' Allow the GcTextBox control to accept only upper case alphabet(A-Z) and SBCS space. gcTextBox1.Format = "AS" ' The GcTextBox control will not try to convert invalid char to valid char automatically. gcTextBox1.AutoConvert = False ' Create an instance of a GcTextBox control. Dim gcTextBox2 As New GcTextBox() ' Accept upper and lower case alphabet, as well as the symbols. Except '#', '@' and '*' chars. gcTextBox2.Format = "aA@^\#\@*" ' The GcTextBox will try to convert the invalid char to valid char automatically. gcTextBox2.AutoConvert = True End Sub