GrapeCity CalendarGrid for Windows Forms 2.0J
CalendarGcDateTimeCellType クラス
メンバ  使用例 

CalendarGcDateTimeCellType を表します。
構文
Public Class CalendarGcDateTimeCellType 
   Inherits CalendarFieldsEditorCell
public class CalendarGcDateTimeCellType : CalendarFieldsEditorCell 
解説
CalendarGcDateTimeCellType を使用すると、機能的な日時入力インタフェースを迅速かつ効率的に設計できます。
使用例
次のサンプルコードは、CalendarGcDateTimeCellType の使用方法を示します。
using System;
using System.Windows.Forms;
using System.Drawing;
using GrapeCity.Win.CalendarGrid.InputMan;
using GrapeCity.Win.CalendarGrid;

namespace CalendarGridSampleCode
{
    class GcDateTimeCellDemo : Form
    {
        private GcCalendarGrid gcCalendarGrid1 = new GcCalendarGrid();
        private Label label = new Label();

        public GcDateTimeCellDemo()
        {
            this.Text = "GcDateCell Demo";
            this.Size = new Size(350, 300);

            // Add GcCalendarGrid to form
            this.gcCalendarGrid1.Dock = DockStyle.Fill;
            this.Controls.Add(this.gcCalendarGrid1);

            this.label.Dock = DockStyle.Bottom;
            this.label.Height = 50;
            this.label.BackColor = SystemColors.Info;
            this.label.Text = "Enter edit mode, you can use the CTR+Left/Right to move cursor between fields, and click the SpinButton to modify the each field value;";
            this.Controls.Add(label);

            this.Load += Form1_Load;

            this.StartPosition = FormStartPosition.CenterScreen;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            CalendarGcDateTimeCellType gcDateCell1 = new CalendarGcDateTimeCellType();
            SetGcDateCellDisplayFields(gcDateCell1);
            SetGcDateCellFields(gcDateCell1);
            SetSideButtons(gcDateCell1);

            CalendarTemplate template1 = CalendarTemplate.CreateDefaultTemplate();
            template1.Content[1, 0].CellType = gcDateCell1;
            template1.Content[2, 0].CellType = gcDateCell1.Clone();
            template1.Content.Columns[0].Width = 130;

            gcCalendarGrid1.Template = template1;
        }

        private void SetGcDateCellFields(CalendarGcDateTimeCellType gcDateCell)
        {
            gcDateCell.Fields.Clear();

            DateYearField fields0 = new DateYearField();
            DateLiteralField fields1 = new DateLiteralField();
            DateMonthField fields2 = new DateMonthField();
            DateLiteralField fields3 = new DateLiteralField();
            DateDayField fields4 = new DateDayField();
            DateLiteralField fields5 = new DateLiteralField();
            DateHourField fields6 = new DateHourField();
            DateLiteralField fields7 = new DateLiteralField();
            DateMinuteField fields8 = new DateMinuteField();
            DateLiteralField fields9 = new DateLiteralField();
            DateSecondField fields10 = new DateSecondField();
            fields1.Text = "/";
            fields3.Text = "/";
            fields7.Text = ":";
            fields9.Text = ":";
            gcDateCell.Fields.AddRange(new DateField[]{
                fields0,fields1,fields2,fields3,fields4,fields5,fields6,fields7,fields8,fields9,fields10,
            });
        }

        private void SetGcDateCellDisplayFields(CalendarGcDateTimeCellType gcDateCell1)
        {
            gcDateCell1.DisplayFields.Clear();

            DateYearDisplayField dateYearDisplayField1 = new DateYearDisplayField();
            DateLiteralDisplayField dateLiteralDisplayField2 = new DateLiteralDisplayField();
            DateMonthDisplayField dateMonthDisplayField1 = new DateMonthDisplayField();
            DateLiteralDisplayField dateLiteralDisplayField3 = new DateLiteralDisplayField();
            DateDayDisplayField dateDayDisplayField1 = new DateDayDisplayField();
            DateLiteralDisplayField dateLiteralDisplayField4 = new DateLiteralDisplayField();
            DateLiteralDisplayField dateLiteralDisplayField5 = new DateLiteralDisplayField();
            DateHourDisplayField dateHourDisplayField6 = new DateHourDisplayField();
            DateLiteralDisplayField dateLiteralDisplayField7 = new DateLiteralDisplayField();
            DateMinuteDisplayField dateMinuteDisplayField8 = new DateMinuteDisplayField();
            DateLiteralDisplayField dateLiteralDisplayField9 = new DateLiteralDisplayField();
            DateSecondDisplayField dateSecondDisplayField10 = new DateSecondDisplayField();

            dateLiteralDisplayField2.Text = "年";
            dateLiteralDisplayField3.Text = "月";
            dateLiteralDisplayField4.Text = "日";
            dateLiteralDisplayField7.Text = ":";
            dateLiteralDisplayField9.Text = ":";

            gcDateCell1.DisplayFields.AddRange(new DateDisplayField[] {
            dateYearDisplayField1,dateLiteralDisplayField2,dateMonthDisplayField1,dateLiteralDisplayField3,dateDayDisplayField1,dateLiteralDisplayField4,
            dateLiteralDisplayField5,dateHourDisplayField6,dateLiteralDisplayField7,dateMinuteDisplayField8,dateLiteralDisplayField9,dateSecondDisplayField10});
        }

        private void SetSideButtons(CalendarGcDateTimeCellType gcDateCell1)
        {
            gcDateCell1.SideButtons.Clear();
            gcDateCell1.SideButtons.Add(new SpinButton());
        }

        [STAThreadAttribute()]
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.Run(new GcDateTimeCellDemo());
        }
    }
}
Imports System.Windows.Forms
Imports System.Drawing
Imports GrapeCity.Win.CalendarGrid.InputMan
Imports GrapeCity.Win.CalendarGrid

Namespace CalendarGridSampleCode
    Class GcDateTimeCellDemo
        Inherits Form
        Private gcCalendarGrid1 As New GcCalendarGrid()
        Private label As New Label()

        Public Sub New()
            Me.Text = "GcDateCell Demo"
            Me.Size = New Size(350, 300)

            ' Add GcCalendarGrid to form
            Me.gcCalendarGrid1.Dock = DockStyle.Fill
            Me.Controls.Add(Me.gcCalendarGrid1)

            Me.label.Dock = DockStyle.Bottom
            Me.label.Height = 50
            Me.label.BackColor = SystemColors.Info
            Me.label.Text = "Enter edit mode, you can use the CTR+Left/Right to move cursor between fields, and click the SpinButton to modify the each field value;"
            Me.Controls.Add(label)

            AddHandler Me.Load, AddressOf Form1_Load

            Me.StartPosition = FormStartPosition.CenterScreen
        End Sub

        Private Sub Form1_Load(sender As Object, e As EventArgs)
            Dim gcDateCell1 As New CalendarGcDateTimeCellType()
            SetGcDateCellDisplayFields(gcDateCell1)
            SetGcDateCellFields(gcDateCell1)
            SetSideButtons(gcDateCell1)

            Dim template1 As CalendarTemplate = CalendarTemplate.CreateDefaultTemplate()
            template1.Content(1, 0).CellType = gcDateCell1
            template1.Content(2, 0).CellType = gcDateCell1.Clone()
            template1.Content.Columns(0).Width = 130

            gcCalendarGrid1.Template = template1
        End Sub

        Private Sub SetGcDateCellFields(gcDateCell As CalendarGcDateTimeCellType)
            gcDateCell.Fields.Clear()

            Dim fields0 As New DateYearField()
            Dim fields1 As New DateLiteralField()
            Dim fields2 As New DateMonthField()
            Dim fields3 As New DateLiteralField()
            Dim fields4 As New DateDayField()
            Dim fields5 As New DateLiteralField()
            Dim fields6 As New DateHourField()
            Dim fields7 As New DateLiteralField()
            Dim fields8 As New DateMinuteField()
            Dim fields9 As New DateLiteralField()
            Dim fields10 As New DateSecondField()
            fields1.Text = "/"
            fields3.Text = "/"
            fields7.Text = ":"
            fields9.Text = ":"
            gcDateCell.Fields.AddRange(New DateField() {fields0, fields1, fields2, fields3, fields4, fields5, _
                fields6, fields7, fields8, fields9, fields10})
        End Sub

        Private Sub SetGcDateCellDisplayFields(gcDateCell1 As CalendarGcDateTimeCellType)
            gcDateCell1.DisplayFields.Clear()

            Dim dateYearDisplayField1 As New DateYearDisplayField()
            Dim dateLiteralDisplayField2 As New DateLiteralDisplayField()
            Dim dateMonthDisplayField1 As New DateMonthDisplayField()
            Dim dateLiteralDisplayField3 As New DateLiteralDisplayField()
            Dim dateDayDisplayField1 As New DateDayDisplayField()
            Dim dateLiteralDisplayField4 As New DateLiteralDisplayField()
            Dim dateLiteralDisplayField5 As New DateLiteralDisplayField()
            Dim dateHourDisplayField6 As New DateHourDisplayField()
            Dim dateLiteralDisplayField7 As New DateLiteralDisplayField()
            Dim dateMinuteDisplayField8 As New DateMinuteDisplayField()
            Dim dateLiteralDisplayField9 As New DateLiteralDisplayField()
            Dim dateSecondDisplayField10 As New DateSecondDisplayField()

            dateLiteralDisplayField2.Text = "年"
            dateLiteralDisplayField3.Text = "月"
            dateLiteralDisplayField4.Text = "日"
            dateLiteralDisplayField7.Text = ":"
            dateLiteralDisplayField9.Text = ":"

            gcDateCell1.DisplayFields.AddRange(New DateDisplayField() {dateYearDisplayField1, dateLiteralDisplayField2, dateMonthDisplayField1, dateLiteralDisplayField3, dateDayDisplayField1, dateLiteralDisplayField4, _
                dateLiteralDisplayField5, dateHourDisplayField6, dateLiteralDisplayField7, dateMinuteDisplayField8, dateLiteralDisplayField9, dateSecondDisplayField10})
        End Sub

        Private Sub SetSideButtons(gcDateCell1 As CalendarGcDateTimeCellType)
            gcDateCell1.SideButtons.Clear()
            gcDateCell1.SideButtons.Add(New SpinButton())
        End Sub

        <STAThreadAttribute> _
        Public Shared Sub Main()
            Application.EnableVisualStyles()
            Application.Run(New GcDateTimeCellDemo())
        End Sub
    End Class
End Namespace
継承階層

System.Object
   GrapeCity.Win.CalendarGrid.CalendarCellType
      GrapeCity.Win.CalendarGrid.InputMan.CalendarInputManCellBaseType
         GrapeCity.Win.CalendarGrid.InputMan.CalendarFieldsEditorCell
            GrapeCity.Win.CalendarGrid.InputMan.CalendarGcDateTimeCellType

参照

CalendarGcDateTimeCellType メンバ
GrapeCity.Win.CalendarGrid.InputMan 名前空間

 

 


c 2008 GrapeCity inc. All rights reserved.