// Please use the following namespace
// using System.Windows.Forms;
// using GrapeCity.Win.Editors;
// using GrapeCity.Win.Editors.Fields;
// Creates an instance of a GcDateTime control.
GcDateTime GcDateTime1 = new GcDateTime();
public void InitializeGcDateTime()
{
// Clears the default Fields.
GcDateTime1.Fields.Clear();
// Sets the AutoSize property to true for calculating the control's height automatically.
GcDateTime1.AutoSize = true;
// Defines the fields by creating new fields and set to GcDateTime control.
DateYearField dateYearField1 = new DateYearField();
DateLiteralField dateLiteralField1 = new DateLiteralField();
DateMonthField dateMonthField1 = new DateMonthField();
DateLiteralField dateLiteralField2 = new DateLiteralField();
DateDayField dateDayField1 = new DateDayField();
DateLiteralField dateLiteralField3 = new DateLiteralField();
DateHourField dateHourField1 = new DateHourField();
DateLiteralField dateLiteralField4 = new DateLiteralField();
DateMinuteField dateMinuteField1 = new DateMinuteField();
DateLiteralField dateLiteralField5 = new DateLiteralField();
DateSecondField dateSecondField1 = new DateSecondField();
dateLiteralField1.Text = "/";
dateLiteralField2.Text = "/";
dateLiteralField4.Text = ":";
dateLiteralField5.Text = ":";
GcDateTime1.Fields.AddRange(new DateField[] {
dateYearField1,
dateLiteralField1,
dateMonthField1,
dateLiteralField2,
dateDayField1,
dateLiteralField3,
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.
GcDateTime1.SideButtons.AddRange(new GrapeCity.Win.Editors.SideButtonBase[] {
symbolButton1,
symbolButton2});
}
private void OnSymbolButton2Click(object sender, EventArgs e)
{
GcDateTime date = sender as GcDateTime;
if (date != null)
{
// Spin the GcDateTime value to the less one.
//GcDateTime1.DoSpinDown(new TimeSpan(1, 0, 0));
date.DoSpinDown(new TimeSpan(1, 0, 0));
}
}
private void OnSymbolButton1Click(object sender, EventArgs e)
{
// Spin the GcDateTime value to the greater one.
GcDateTime1.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 GcDateTime control.
Private GcDateTime1 As New GcDateTime()
Public Sub InitializeGcDateTime()
' Clears the default Fields.
GcDateTime1.Fields.Clear()
' Sets the AutoSize property to true for calculating the control's height automatically.
GcDateTime1.AutoSize = True
' Defines the fields by creating new fields and set to GcDateTime 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()
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()
dateLiteralField1.Text = "/"
dateLiteralField2.Text = "/"
dateLiteralField4.Text = ":"
dateLiteralField5.Text = ":"
GcDateTime1.Fields.AddRange(New DateField() {dateYearField1, dateLiteralField1, dateMonthField1, dateLiteralField2, dateDayField1, dateLiteralField3, _
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.
GcDateTime1.SideButtons.AddRange(New GrapeCity.Win.Editors.SideButtonBase() {symbolButton1, symbolButton2})
End Sub
Private Sub OnSymbolButton2Click(ByVal sender As Object, ByVal e As EventArgs)
' Spin the GcDateTime value to the less one.
GcDateTime1.DoSpinDown(New TimeSpan(1, 0, 0))
End Sub
Private Sub OnSymbolButton1Click(ByVal sender As Object, ByVal e As EventArgs)
' Spin the GcDateTime value to the greater one.
GcDateTime1.DoSpinUp(New TimeSpan(1, 0, 0))
End Sub