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

既定の検証アイテムのコレクションを取得または設定します。
構文
Public Overrides Property DefaultValidateItems As Validator(Of GcNumber)
public override Validator<GcNumber> DefaultValidateItems {get; set;}

プロパティ値

検証アイテムのコレクションを表すValidator<GcNumber>. ValidateItemCollectionオブジェクト。
使用例
検証アイテムと検証アクションを設定した GcNumberValidator コンポーネントを作成するコード例を次に示します。
//  Please use the following namespace
//  using System.Windows.Forms;
//  using GrapeCity.Win.Editors;
//  using System.Drawing;

public void SetGcNumberValidatorDefaultSettings()
{
    // Creates an instance of a GcNumber control.
    GcNumber gcNumber1 = new GcNumber();
    // Creates an instance of a GcNumberValidator component.
    GcNumberValidator gcNumberValidator1 = new GcNumberValidator();
    // Creates a ColorNotify item for notifying validation mode by changing colors.
    ColorNotify colorNotify1 = new ColorNotify();
    colorNotify1.InvalidBackColor = Color.Yellow;
    colorNotify1.InvalidForeColor = Color.Red;
    colorNotify1.ValidBackColor = Color.White;
    colorNotify1.ValidForeColor = Color.Black;
    // Creates a TipNotify item for notifying validation mode by pop up a tip.
    TipNotify tipNotify1 = new TipNotify();
    // Creates a CompareValue object.
    GcNumberValidator.CompareValue compareValue1 = new GcNumberValidator.CompareValue();
    // Adds some ValidateAction to the DefaultValidateActions.
    gcNumberValidator1.DefaultValidateActions.AddRange(new ValidateAction[] {colorNotify1,tipNotify1});
    // Sets the ComparedValue to 0m, the value of the target control should compare with this.
    compareValue1.ComparedValue = 0m;
    // Sets the DifferenceValue to 0m, the value of the target control should compare with the ComparedValue by
    // the distance defined by this.
    compareValue1.DifferenceValue = 0m;
    // Sets the InvalidMessage in order to show the string when the TipNotify poped up the tip.
    compareValue1.InvalidMessage = "The value has to greater than 1.";
    // Adds the compareValue to the DefaultValidateItems.
    gcNumberValidator1.DefaultValidateItems.AddRange(new object[] {compareValue1});
    // The validating operation will process in real time after every input action.
    gcNumberValidator1.SetSupportRealTimeValidating(gcNumber1, true);
    // The gcNumber1 will use the DefaultValidateActions's settings
    // as well as using the ValidateAction defined for itself.
    gcNumberValidator1.SetUseDefaultValidateActions(gcNumber1, true);
    // The gcNumber1 will use the DefaultValidateItems's settings
    // as well as using the ValidateItems defined for itself.
    gcNumberValidator1.SetUseDefaultValidateItems(gcNumber1, true);
}
'  Please use the following namespace
'  Imports System.Windows.Forms;
'  Imports GrapeCity.Win.Editors;
'  Imports System.Drawing;

Public Sub SetGcNumberValidatorDefaultSettings()
    ' Creates an instance of a GcNumber control.
    Dim gcNumber1 As New GcNumber()
    ' Creates an instance of a GcNumberValidator component.
    Dim gcNumberValidator1 As New GcNumberValidator()
    ' Creates a ColorNotify item for notifying validation mode by changing colors.
    Dim colorNotify1 As New ColorNotify()
    colorNotify1.InvalidBackColor = Color.Yellow
    colorNotify1.InvalidForeColor = Color.Red
    colorNotify1.ValidBackColor = Color.White
    colorNotify1.ValidForeColor = Color.Black
    ' Creates a TipNotify item for notifying validation mode by pop up a tip.
    Dim tipNotify1 As New TipNotify()
    ' Creates a CompareValue object.
    Dim compareValue1 As New GcNumberValidator.CompareValue()
    ' Adds some ValidateAction to the DefaultValidateActions.
    gcNumberValidator1.DefaultValidateActions.AddRange(New ValidateAction() {colorNotify1, tipNotify1})
    ' Sets the ComparedValue to 0m, the value of the target control should compare with this.
    compareValue1.ComparedValue = 0D
    ' Sets the DifferenceValue to 0m, the value of the target control should compare with the ComparedValue by
    ' the distance defined by this.
    compareValue1.DifferenceValue = 0D
    ' Sets the InvalidMessage in order to show the string when the TipNotify poped up the tip.
    compareValue1.InvalidMessage = "The value has to greater than 1."
    ' Adds the compareValue to the DefaultValidateItems.
    gcNumberValidator1.DefaultValidateItems.AddRange(New Object() {compareValue1})
    ' The validating operation will process in real time after every input action.
    gcNumberValidator1.SetSupportRealTimeValidating(gcNumber1, True)
    ' The gcNumber1 will use the DefaultValidateActions's settings
    ' as well as using the ValidateAction defined for itself.
    gcNumberValidator1.SetUseDefaultValidateActions(gcNumber1, True)
    ' The gcNumber1 will use the DefaultValidateItems's settings
    ' as well as using the ValidateItems defined for itself.
    gcNumberValidator1.SetUseDefaultValidateItems(gcNumber1, True)
End Sub
参照

GcNumberValidator クラス
GcNumberValidator メンバ

 

 


© 2004-2015 GrapeCity inc. All rights reserved.