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

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

プロパティ値

GcTime 内の項目を表す GrapeCity.Win.Editors.Fields.TimeFieldCollection
解説
このプロパティは、このコントロールの Value の表示方法を決定します。
使用例
次のサンプルコードは、いくつかのサイドボタンとフィールドを持つ GcTime コントロールを作成します。いずれかのサイドボタンをクリックすると、このコントロールの値が変更されます。このサンプルコードでは、SideButtons および Fields プロパティと DoSpinUp(TimeSpan) または DoSpinDown(TimeSpan) メソッドも使用しています。
//  Please use the following namespace
//  using System.Windows.Forms;
//  using GrapeCity.Win.Editors;
//  using GrapeCity.Win.Editors.Fields;

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

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

    // Sets the AutoSize property to true for calculating the control's height automatically.
    gcTime1.AutoSize = true;

    // Defines the fields by creating new fields and set to GcTime control.
    DateHourField dateHourField1 = new DateHourField();
    DateLiteralField dateLiteralField4 = new DateLiteralField();
    DateMinuteField dateMinuteField1 = new DateMinuteField();
    DateLiteralField dateLiteralField5 = new DateLiteralField();
    DateSecondField dateSecondField1 = new DateSecondField();
    dateLiteralField4.Text = ":";
    dateLiteralField5.Text = ":";
    gcTime1.Fields.AddRange(new DateField[] {
    dateHourField1,
    dateLiteralField4,
    dateMinuteField1,
    dateLiteralField5,
    dateSecondField1});

    // Defines SymbolButtons.
    SymbolButton symbolButton1 = new GrapeCity.Win.Editors.SymbolButton();
    SymbolButton symbolButton2 = new GrapeCity.Win.Editors.SymbolButton();
    symbolButton1.Name = "symbolButton1";
    symbolButton1.Position = GrapeCity.Win.Editors.ButtonPosition.LeftOutside;
    symbolButton1.Symbol = GrapeCity.Win.Editors.Symbols.Arrow;
    symbolButton1.SymbolDirection = GrapeCity.Win.Editors.SymbolDirection.Up;
    symbolButton1.UseVisualStyleBackColor = true;
    symbolButton1.Click += new EventHandler(OnSymbolButton1Click);
    symbolButton2.Name = "symbolButton2";
    symbolButton2.Position = GrapeCity.Win.Editors.ButtonPosition.RightOutside;
    symbolButton2.Symbol = GrapeCity.Win.Editors.Symbols.Arrow;
    symbolButton2.SymbolDirection = GrapeCity.Win.Editors.SymbolDirection.Down;
    symbolButton2.Click += new EventHandler(OnSymbolButton2Click);

    // Adds SymbolButtons to the SideButtons collection.
    gcTime1.SideButtons.AddRange(new GrapeCity.Win.Editors.SideButtonBase[] {
    symbolButton1,
    symbolButton2});

}

private void OnSymbolButton2Click(object sender, EventArgs e)
{
    GcTime date = sender as GcTime;
    if (date != null)
    {
        // Spin the GcTime value to the less one.
        //gcTime1.DoSpinDown(new TimeSpan(1, 0, 0));
        date.DoSpinDown(new TimeSpan(1, 0, 0));
    }
}

private void OnSymbolButton1Click(object sender, EventArgs e)
{
    // Spin the GcTime value to the greater one.
    gcTime1.DoSpinUp(new TimeSpan(1, 0, 0));
}
'  Please use the following namespace
'  Imports System.Windows.Forms;
'  Imports GrapeCity.Win.Editors;
'  Imports GrapeCity.Win.Editors.Fields;

' Creates an instance of a GcTime control.
Private gcTime1 As New GcTime()
Public Sub InitializeGcTime()

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

    ' Sets the AutoSize property to true for calculating the control's height automatically.
    gcTime1.AutoSize = True

    ' Defines the fields by creating new fields and set to GcTime control.
    Dim dateHourField1 As New DateHourField()
    Dim dateLiteralField4 As New DateLiteralField()
    Dim dateMinuteField1 As New DateMinuteField()
    Dim dateLiteralField5 As New DateLiteralField()
    Dim dateSecondField1 As New DateSecondField()

    dateLiteralField4.Text = ":"
    dateLiteralField5.Text = ":"
    gcTime1.Fields.AddRange(New DateField() {dateHourField1, dateLiteralField4, dateMinuteField1, dateLiteralField5, dateSecondField1})

    ' Defines SymbolButtons.
    Dim symbolButton1 As SymbolButton = New GrapeCity.Win.Editors.SymbolButton()
    Dim symbolButton2 As SymbolButton = New GrapeCity.Win.Editors.SymbolButton()
    symbolButton1.Name = "symbolButton1"
    symbolButton1.Position = GrapeCity.Win.Editors.ButtonPosition.LeftOutside
    symbolButton1.Symbol = GrapeCity.Win.Editors.Symbols.Arrow
    symbolButton1.SymbolDirection = GrapeCity.Win.Editors.SymbolDirection.Up
    symbolButton1.UseVisualStyleBackColor = True
    AddHandler symbolButton1.Click, AddressOf OnSymbolButton1Click
    symbolButton2.Name = "symbolButton2"
    symbolButton2.Position = GrapeCity.Win.Editors.ButtonPosition.RightOutside
    symbolButton2.Symbol = GrapeCity.Win.Editors.Symbols.Arrow
    symbolButton2.SymbolDirection = GrapeCity.Win.Editors.SymbolDirection.Down
    AddHandler symbolButton2.Click, AddressOf OnSymbolButton2Click

    ' Adds SymbolButtons to the SideButtons collection.
    gcTime1.SideButtons.AddRange(New GrapeCity.Win.Editors.SideButtonBase() {symbolButton1, symbolButton2})

End Sub

Private Sub OnSymbolButton2Click(ByVal sender As Object, ByVal e As EventArgs)
    ' Spin the GcTime value to the less one.
    gcTime1.DoSpinDown(New TimeSpan(1, 0, 0))
End Sub

Private Sub OnSymbolButton1Click(ByVal sender As Object, ByVal e As EventArgs)
    ' Spin the GcTime value to the greater one.
    gcTime1.DoSpinUp(New TimeSpan(1, 0, 0))
End Sub
参照

GcTime クラス
GcTime メンバ

 

 


© 2004-2015 GrapeCity inc. All rights reserved.