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

値がNothingあるいはString.Emptyに等しい場合に表示する文字列に関する設定を取得します。
構文
Public ReadOnly Property AlternateText As MaskAlternateText
public MaskAlternateText AlternateText {get;}

プロパティ値

文字列の設定を表すMaskAlternateTextオブジェクト。
解説
このプロパティは、入力フォーカスがあるかどうかにかかわらず、コントロールの値がSystem.String.Emptyのときのテキストとテキストの色を決定します。
使用例
代替テキストを設定した GcMask コントロールを作成するコード例を次に示します。
//  Please use the following namespace
//  using System.Windows.Forms;
//  using GrapeCity.Win.Editors;
//  using System.Drawing;

public void SetAlternateTextSettings()
{
    // Creates an instance of a GcMask control.
    GcMask gcMask1 = new GcMask();
    gcMask1.Fields.AddRange(@"〒\D{3}-\D{4}");
    // Sets the text of the DisplayNull property.
    // The text will displayed when the GcMask control lost focus.
    gcMask1.AlternateText.DisplayNull.Text = "{#}";
    // Sets the ForeColor of the DisplayNull property.
    // The text will displayed with this color.
    gcMask1.AlternateText.DisplayNull.ForeColor = Color.Gray;
    // Sets the text of the Null property.
    // The text will displayed when the GcMask control got focus.
    gcMask1.AlternateText.Null.Text = "Please input postal here";
    // Sets the ForeColor of the Null property.
    // The text will displayed with this color.
    gcMask1.AlternateText.Null.ForeColor = Color.Gray;

    // Set forecolor for all literal fields.
    List<GrapeCity.Win.Editors.Fields.MaskLiteralField> literalFields = gcMask1.Fields.FindAll<GrapeCity.Win.Editors.Fields.MaskLiteralField>();
    foreach (GrapeCity.Win.Editors.Fields.MaskLiteralField field in literalFields)
    {
        field.ForeColor = Color.Red;
    }

}
'  Please use the following namespace
'  Imports System.Windows.Forms;
'  Imports GrapeCity.Win.Editors;
'  Imports System.Drawing;

Public Sub SetAlternateTextSettings()
    ' Creates an instance of a GcMask control.
    Dim gcMask1 As New GcMask()
    gcMask1.Fields.AddRange("〒\D{3}-\D{4}")
    ' Sets the text of the DisplayNull property.
    ' The text will displayed when the GcMask control lost focus.
    gcMask1.AlternateText.DisplayNull.Text = "{#}"
    ' Sets the ForeColor of the DisplayNull property.
    ' The text will displayed with this color.
    gcMask1.AlternateText.DisplayNull.ForeColor = Color.Gray
    ' Sets the text of the Null property.
    ' The text will displayed when the GcMask control got focus.
    gcMask1.AlternateText.Null.Text = "Please input postal here"
    ' Sets the ForeColor of the Null property.
    ' The text will displayed with this color.
    gcMask1.AlternateText.Null.ForeColor = Color.Gray

    ' Set forecolor for all literal fields.
    Dim literalFields As List(Of GrapeCity.Win.Editors.Fields.MaskLiteralField) = gcMask1.Fields.FindAll(Of GrapeCity.Win.Editors.Fields.MaskLiteralField)()
    For Each field As GrapeCity.Win.Editors.Fields.MaskLiteralField In literalFields
        field.ForeColor = Color.Red
    Next

End Sub
参照

GcMask クラス
GcMask メンバ

 

 


© 2004-2015 GrapeCity inc. All rights reserved.