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

GcDate 内の項目を表す GrapeCity.Win.Editors.Fields.DateFieldCollection
構文
Public Shadows ReadOnly Property Fields As DateTimeFieldCollection
public new DateTimeFieldCollection Fields {get;}

プロパティ値

GcDate 内の項目を表す GrapeCity.Win.Editors.Fields.DateTimeFieldCollection
解説
このプロパティは、このコントロールの Value の表示および編集方法を決定します。
使用例
次のサンプルコードは、いくつかのサイドボタンとフィールドを持つ GcDate コントロールを作成します。いずれかのサイドボタンをクリックすると、このコントロールの値が変更されます。このサンプルコードでは、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 GcDate control.
GcDate gcDate1 = new GcDate();
public void InitializeGcDate()
{

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

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

    // Defines the fields by creating new fields and set to GcDate control.
    DateYearField dateYearField1 = new DateYearField();
    DateLiteralField dateLiteralField1 = new DateLiteralField();
    DateMonthField dateMonthField1 = new DateMonthField();
    DateLiteralField dateLiteralField2 = new DateLiteralField();
    DateDayField dateDayField1 = new DateDayField();
    dateLiteralField1.Text = "/";
    dateLiteralField2.Text = "/";
    gcDate1.Fields.AddRange(new DateField[] {
    dateYearField1,
    dateLiteralField1,
    dateMonthField1,
    dateLiteralField2,
    dateDayField1});

    // 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.
    gcDate1.SideButtons.AddRange(new GrapeCity.Win.Editors.SideButtonBase[] {
    symbolButton1,
    symbolButton2});

}

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

private void OnSymbolButton1Click(object sender, EventArgs e)
{
    // Spin the GcDate value to the greater one.
    gcDate1.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 GcDate control.
Private GcDate1 As New GcDate()
Public Sub InitializeGcDate()

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

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

    ' Defines the fields by creating new fields and set to GcDate control.
    Dim dateYearField1 As New DateYearField()
    Dim dateLiteralField1 As New DateLiteralField()
    Dim dateMonthField1 As New DateMonthField()
    Dim dateLiteralField2 As New DateLiteralField()
    Dim dateDayField1 As New DateDayField()
    Dim dateLiteralField3 As New DateLiteralField()
    dateLiteralField1.Text = "/"
    dateLiteralField2.Text = "/"
    GcDate1.Fields.AddRange(New DateField() {dateYearField1, dateLiteralField1, dateMonthField1, dateLiteralField2, dateDayField1})

    ' 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.
    GcDate1.SideButtons.AddRange(New GrapeCity.Win.Editors.SideButtonBase() {symbolButton1, symbolButton2})

End Sub

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

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

GcDate クラス
GcDate メンバ

 

 


© 2004-2015 GrapeCity inc. All rights reserved.