GrapeCity.Win.CalendarGrid.v20 アセンブリ > GrapeCity.Win.CalendarGrid.InputMan 名前空間 : CalendarGcTimeSpanCellType クラス |
Public Class CalendarGcTimeSpanCellType Inherits CalendarFieldsEditorCell
public class CalendarGcTimeSpanCellType : CalendarFieldsEditorCell
CalendarGcTimeSpanCellType を使用すると、機能的なタイムスパン(期間や時間の長さ)入力インタフェースを迅速かつ効率的に設計できます。
CalendarGcTimeSpanCellType を使用した場合、タイムスパン値のデータを検証する必要が少なくなります。
using System; using System.Windows.Forms; using System.Drawing; using GrapeCity.Win.CalendarGrid.InputMan; using GrapeCity.Win.CalendarGrid; namespace CalendarGridSampleCode { class GcTimeSpanCellDemo : Form { private GcCalendarGrid gcCalendarGrid1 = new GcCalendarGrid(); private Label label = new Label(); public GcTimeSpanCellDemo() { this.Text = "GcTimeSpanCell 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, click the SpinButton to modify the each field value; exit the edit mode, only the hh:mm:ss will display."; this.Controls.Add(label); this.Load += Form1_Load; this.StartPosition = FormStartPosition.CenterScreen; } private void Form1_Load(object sender, EventArgs e) { CalendarGcTimeSpanCellType gcTimeSpanCell1 = new CalendarGcTimeSpanCellType(); SetGcTimeSpanCellFields(gcTimeSpanCell1); SetGcTimeSpanCellDisplayFields(gcTimeSpanCell1); SetSideButtons(gcTimeSpanCell1); CalendarTemplate template1 = CalendarTemplate.CreateDefaultTemplate(); template1.Content[1, 0].CellType = gcTimeSpanCell1; template1.Content[2, 0].CellType = gcTimeSpanCell1.Clone(); gcCalendarGrid1.Template = template1; } private void SetGcTimeSpanCellFields(CalendarGcTimeSpanCellType gcTimeSpanCell1) { gcTimeSpanCell1.Fields.Clear(); TimeSpanSignField fields0 = new TimeSpanSignField(); TimeSpanDayField fields1 = new TimeSpanDayField(); fields1.Digits = 1; TimeSpanLiteralField fields2 = new TimeSpanLiteralField(); fields2.Text = "."; TimeSpanHourField fields3 = new TimeSpanHourField(); fields3.Digits = 2; TimeSpanLiteralField fields4 = new TimeSpanLiteralField(); fields4.Text = ":"; TimeSpanMinuteField fields5 = new TimeSpanMinuteField(); fields5.Digits = 2; TimeSpanLiteralField fields6 = new TimeSpanLiteralField(); fields6.Text = ":"; TimeSpanSecondField fields7 = new TimeSpanSecondField(); fields7.Digits = 2; gcTimeSpanCell1.Fields.AddRange(new TimeSpanField[] { fields0, fields1, fields2, fields3, fields4, fields5, fields6, fields7 }); } private void SetGcTimeSpanCellDisplayFields(CalendarGcTimeSpanCellType gcTimeSpanCell1) { gcTimeSpanCell1.DisplayFields.Clear(); TimeSpanSignDisplayField timeSpanSignDisplayField1 = new TimeSpanSignDisplayField(); TimeSpanHourDisplayField timeSpanHourDisplayField1 = new TimeSpanHourDisplayField(); TimeSpanLiteralDisplayField timeSpanLiteralDisplayField1 = new TimeSpanLiteralDisplayField(); TimeSpanMinuteDisplayField timeSpanMinuteDisplayField1 = new TimeSpanMinuteDisplayField(); TimeSpanLiteralDisplayField timeSpanLiteralDisplayField2 = new TimeSpanLiteralDisplayField(); TimeSpanSecondDisplayField timeSpanSecondDisplayField1 = new TimeSpanSecondDisplayField(); timeSpanHourDisplayField1.Digits = 2; timeSpanLiteralDisplayField1.Text = ":"; timeSpanMinuteDisplayField1.Digits = 2; timeSpanLiteralDisplayField2.Text = ":"; timeSpanSecondDisplayField1.Digits = 2; gcTimeSpanCell1.DisplayFields.AddRange(new TimeSpanDisplayField[] { timeSpanSignDisplayField1, timeSpanHourDisplayField1, timeSpanLiteralDisplayField1, timeSpanMinuteDisplayField1, timeSpanLiteralDisplayField2, timeSpanSecondDisplayField1 }); } private void SetSideButtons(CalendarGcTimeSpanCellType gcTimeSpanCell1) { gcTimeSpanCell1.SideButtons.Clear(); gcTimeSpanCell1.SideButtons.Add(new SpinButton()); } [STAThreadAttribute()] public static void Main() { Application.EnableVisualStyles(); Application.Run(new GcTimeSpanCellDemo()); } } }
Imports System.Windows.Forms Imports System.Drawing Imports GrapeCity.Win.CalendarGrid.InputMan Imports GrapeCity.Win.CalendarGrid Namespace CalendarGridSampleCode Class GcTimeSpanCellDemo Inherits Form Private gcCalendarGrid1 As New GcCalendarGrid() Private label As New Label() Public Sub New() Me.Text = "GcTimeSpanCell 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, click the SpinButton to modify the each field value; exit the edit mode, only the hh:mm:ss will display." 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 gcTimeSpanCell1 As New CalendarGcTimeSpanCellType() SetGcTimeSpanCellFields(gcTimeSpanCell1) SetGcTimeSpanCellDisplayFields(gcTimeSpanCell1) SetSideButtons(gcTimeSpanCell1) Dim template1 As CalendarTemplate = CalendarTemplate.CreateDefaultTemplate() template1.Content(1, 0).CellType = gcTimeSpanCell1 template1.Content(2, 0).CellType = gcTimeSpanCell1.Clone() gcCalendarGrid1.Template = template1 End Sub Private Sub SetGcTimeSpanCellFields(gcTimeSpanCell1 As CalendarGcTimeSpanCellType) gcTimeSpanCell1.Fields.Clear() Dim fields0 As New TimeSpanSignField() Dim fields1 As New TimeSpanDayField() fields1.Digits = 1 Dim fields2 As New TimeSpanLiteralField() fields2.Text = "." Dim fields3 As New TimeSpanHourField() fields3.Digits = 2 Dim fields4 As New TimeSpanLiteralField() fields4.Text = ":" Dim fields5 As New TimeSpanMinuteField() fields5.Digits = 2 Dim fields6 As New TimeSpanLiteralField() fields6.Text = ":" Dim fields7 As New TimeSpanSecondField() fields7.Digits = 2 gcTimeSpanCell1.Fields.AddRange(New TimeSpanField() {fields0, fields1, fields2, fields3, fields4, fields5, _ fields6, fields7}) End Sub Private Sub SetGcTimeSpanCellDisplayFields(gcTimeSpanCell1 As CalendarGcTimeSpanCellType) gcTimeSpanCell1.DisplayFields.Clear() Dim timeSpanSignDisplayField1 As New TimeSpanSignDisplayField() Dim timeSpanHourDisplayField1 As New TimeSpanHourDisplayField() Dim timeSpanLiteralDisplayField1 As New TimeSpanLiteralDisplayField() Dim timeSpanMinuteDisplayField1 As New TimeSpanMinuteDisplayField() Dim timeSpanLiteralDisplayField2 As New TimeSpanLiteralDisplayField() Dim timeSpanSecondDisplayField1 As New TimeSpanSecondDisplayField() timeSpanHourDisplayField1.Digits = 2 timeSpanLiteralDisplayField1.Text = ":" timeSpanMinuteDisplayField1.Digits = 2 timeSpanLiteralDisplayField2.Text = ":" timeSpanSecondDisplayField1.Digits = 2 gcTimeSpanCell1.DisplayFields.AddRange(New TimeSpanDisplayField() {timeSpanSignDisplayField1, timeSpanHourDisplayField1, timeSpanLiteralDisplayField1, timeSpanMinuteDisplayField1, timeSpanLiteralDisplayField2, timeSpanSecondDisplayField1}) End Sub Private Sub SetSideButtons(gcTimeSpanCell1 As CalendarGcTimeSpanCellType) gcTimeSpanCell1.SideButtons.Clear() gcTimeSpanCell1.SideButtons.Add(New SpinButton()) End Sub <STAThreadAttribute> _ Public Shared Sub Main() Application.EnableVisualStyles() Application.Run(New GcTimeSpanCellDemo()) 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.CalendarGcTimeSpanCellType