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

コントロールの表示フィールドを取得します。
構文
Public Shadows ReadOnly Property DisplayFields As DateTimeDisplayFieldCollection
public new DateTimeDisplayFieldCollection DisplayFields {get;}

プロパティ値

表示フィールドのコレクションを示す GrapeCity.Win.Editors.Fields.TimeDisplayFieldCollection オブジェクト。
解説
このプロパティは、このコントロールに入力フォーカスがないときの Value の表示方法を決定します。
使用例
次のサンプルコードは、代替テキスト設定と特定の表示フィールドを持つ GcTime コントロールを作成します。また、AlternateText プロパティと DisplayFields プロパティも使用しています。
//  Please use the following namespace
//  using System.Windows.Forms;
//  using GrapeCity.Win.Editors;
//  using System.Drawing;

public void SetAlternateTextSettings()
{
    // Creates an instance of a GcTime control.
    GcTime gcTime1 = new GcTime();

    // Clear the default Fields
    gcTime1.Fields.Clear();

    // Sets the text of the DisplayNull property.
    // The text will displayed when the GcTime control lost focus.
    gcTime1.AlternateText.DisplayNull.Text = "Please Input here";
    // Sets the ForeColor of the DisplayNull property.
    // The text will displayed with this color.
    gcTime1.AlternateText.DisplayNull.ForeColor = Color.Red;
    // Sets the text of the Null property.
    // The text will displayed when the GcTime control got focus.
    gcTime1.AlternateText.Null.Text = "Now the value is null";
    // Sets the ForeColor of the Null property.
    // The text will displayed with this color.
    gcTime1.AlternateText.Null.ForeColor = Color.Blue;

    // Defines the fields by format string.
    gcTime1.Fields.AddRange(@"h:mm:ss");

    // Defines the display fields by format string.
    gcTime1.DisplayFields.AddRange(@"h:mm:ss");

    // Set Font of all DateLiteralField instances.
    List<GrapeCity.Win.Editors.Fields.DateLiteralField> literalFields = gcTime1.Fields.FindAll<GrapeCity.Win.Editors.Fields.DateLiteralField>();
    foreach (GrapeCity.Win.Editors.Fields.DateLiteralField field in literalFields)
    {
        field.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
    }

    // Sets the value of the GcTime to a TimeSpan value that out of Era.
    gcTime1.Value = new System.TimeSpan(12, 21, 52, 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 GcTime control.
    Dim gcTime1 As New GcTime()

    ' Clear the default Fields
    gcTime1.Fields.Clear()

    ' Sets the text of the DisplayNull property.
    ' The text will displayed when the GcTime control lost focus.
    gcTime1.AlternateText.DisplayNull.Text = "Please Input here"
    ' Sets the ForeColor of the DisplayNull property.
    ' The text will displayed with this color.
    gcTime1.AlternateText.DisplayNull.ForeColor = Color.Red
    ' Sets the text of the Null property.
    ' The text will displayed when the GcTime control got focus.
    gcTime1.AlternateText.Null.Text = "Now the value is null"
    ' Sets the ForeColor of the Null property.
    ' The text will displayed with this color.
    gcTime1.AlternateText.Null.ForeColor = Color.Blue

    ' Defines the fields by format string.
    gcTime1.Fields.AddRange("h:mm:ss")

    ' Defines the display fields by format string.
    gcTime1.DisplayFields.AddRange("h:mm:ss")

    ' Set Font of all DateLiteralField instances.
    Dim literalFields As List(Of GrapeCity.Win.Editors.Fields.DateLiteralField) = gcTime1.Fields.FindAll(Of GrapeCity.Win.Editors.Fields.DateLiteralField)()
    For Each field As GrapeCity.Win.Editors.Fields.DateLiteralField In literalFields
        field.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134)
    Next

    ' Sets the value of the GcTime to a TimeSpan value that out of Era.
    gcTime1.Value = New System.DateTime(12, 21, 52, 0)
End Sub
参照

GcTime クラス
GcTime メンバ

 

 


© 2004-2015 GrapeCity inc. All rights reserved.