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

値がNothingまたは0のときに表示する文字列に関する設定を取得します。
構文
Public ReadOnly Property AlternateText As NumberAlternateText
public NumberAlternateText AlternateText {get;}

プロパティ値

文字列の設定を表すNumberAlternateTextオブジェクト。
解説
このプロパティを設定すると、編集モードおよび表示モードにおいてコントロールの値が0またはNullのときに、設定したテキストが代わりに表示されます。
使用例
代替テキストと表示フィールドを設定した GcNumber コントロールを作成するコード例を次に示します。この例では他に DisplayFields と AlternateText プロパティを使用しています。
//  Please use the following namespace
//  using System.Windows.Forms;
//  using GrapeCity.Win.Editors;
//  using System.Drawing;

public void SetAlternateTextSettings()
{
    // Creates an instance of a GcNumber control.
    GcNumber gcNumber1 = new GcNumber();
    // Clear the default DisplayFields
    gcNumber1.DisplayFields.Clear();
    // Sets the text of the DisplayNull property.
    // The text will displayed when the GcNumber control lost focus.
    gcNumber1.AlternateText.DisplayNull.Text = "Null";
    // Sets the ForeColor of the DisplayNull property.
    // The text will displayed with this color.
    gcNumber1.AlternateText.DisplayNull.ForeColor = Color.Gray;
    // Sets the text of the Null property.
    // The text will displayed when the GcNumber control got focus.
    gcNumber1.AlternateText.Null.Text = "Please input a number.";
    // Sets the ForeColor of the Null property.
    // The text will displayed with this color.
    gcNumber1.AlternateText.Null.ForeColor = Color.Gray;
    // Sets the DisplayZero.Text to a string for displaying when the value is zero without the input focus.
    gcNumber1.AlternateText.DisplayZero.Text = "Zero";
    // Sets the Zero.Text to a string for displaying when the value is zero with the input focus.
    gcNumber1.AlternateText.Zero.Text = "Please input a number.";

    // Customize the fields.
    gcNumber1.Fields.SetFields("###,###,###0.00", "+", "", "-", "");

    // Defines the display fields.
    NumberSignDisplayField numberSignDisplayField1 = new NumberSignDisplayField();
    NumberIntegerPartDisplayField numberIntegerPartDisplayField1 = new NumberIntegerPartDisplayField();
    numberIntegerPartDisplayField1.GroupSizes = new int[] {0};
    numberIntegerPartDisplayField1.MinDigits = 9;
    gcNumber1.DisplayFields.AddRange(new NumberDisplayField[] {
    numberSignDisplayField1,
    numberIntegerPartDisplayField1});

    // Sets the value of the GcNumber for displaying the AlternateText.Zero.Text abd AlternateText.DisplayZero.Text.
    gcNumber1.Value = 0;
}
'  Please use the following namespace
'  Imports System.Windows.Forms;
'  Imports GrapeCity.Win.Editors;
'  Imports System.Drawing;

Public Sub SetAlternateTextSettings()
    ' Creates an instance of a GcNumber control.
    Dim gcNumber1 As New GcNumber()
    ' Clear the default DisplayFields
    gcNumber1.DisplayFields.Clear()
    ' Sets the text of the DisplayNull property.
    ' The text will displayed when the GcNumber control lost focus.
    gcNumber1.AlternateText.DisplayNull.Text = "Null"
    ' Sets the ForeColor of the DisplayNull property.
    ' The text will displayed with this color.
    gcNumber1.AlternateText.DisplayNull.ForeColor = Color.Gray
    ' Sets the text of the Null property.
    ' The text will displayed when the GcNumber control got focus.
    gcNumber1.AlternateText.Null.Text = "Please input a number."
    ' Sets the ForeColor of the Null property.
    ' The text will displayed with this color.
    gcNumber1.AlternateText.Null.ForeColor = Color.Gray
    ' Sets the DisplayZero.Text to a string for displaying when the value is zero without the input focus.
    gcNumber1.AlternateText.DisplayZero.Text = "Zero"
    ' Sets the Zero.Text to a string for displaying when the value is zero with the input focus.
    gcNumber1.AlternateText.Zero.Text = "Please input a number."

    ' Customize the fields.
    gcNumber1.Fields.SetFields("###,###,###0.00", "+", "", "-", "")

    ' Defines the display fields.
    Dim numberSignDisplayField1 As New NumberSignDisplayField()
    Dim numberIntegerPartDisplayField1 As New NumberIntegerPartDisplayField()
    numberIntegerPartDisplayField1.GroupSizes = New Integer() {0}
    numberIntegerPartDisplayField1.MinDigits = 9
    gcNumber1.DisplayFields.AddRange(New NumberDisplayField() {numberSignDisplayField1, numberIntegerPartDisplayField1})

    ' Sets the value of the GcNumber for displaying the AlternateText.Zero.Text abd AlternateText.DisplayZero.Text.
    gcNumber1.Value = 0
End Sub
参照

GcNumber クラス
GcNumber メンバ

 

 


© 2004-2015 GrapeCity inc. All rights reserved.