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

GcMaskedComboBoxコントロールの代替テキストを取得します。
構文
Public ReadOnly Property AlternateText As MaskedComboAlternateText
public MaskedComboAlternateText AlternateText {get;}

プロパティ値

代替テキストを示すMaskedComboAlternateText値。
解説
現在の値がSystem.String.Emptyで、このコントロールに入力フォーカスがある場合、このプロパティはテキストとテキストの文字色を決定します。
使用例
代替テキストを設定したGcMaskedComboBoxコントロールを作成する方法を次に示します。
'  Please use the following namespace
'  Imports System.Windows.Forms;
'  Imports GrapeCity.Win.Editors;
'  Imports System.Drawing;

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

    ' Set forecolor for all literal fields.
    Dim literalFields As List(Of GrapeCity.Win.Editors.Fields.MaskLiteralField) = gcMaskedComboBox1.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
//  Please use the following namespace
//  using System.Windows.Forms;
//  using GrapeCity.Win.Editors;
//  using System.Drawing;

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


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

GcMaskedComboBox クラス
GcMaskedComboBox メンバ

 

 


© 2004-2015 GrapeCity inc. All rights reserved.