キーボード操作でカレンダーの日付選択を行いたい

文書番号 : 38996     文書種別 : 使用方法     登録日 : 2015/07/08     最終更新日 : 2015/07/08
文書を印刷する
対象製品
SPREAD for Windows Forms 8.0J
詳細
GcDateTime型セルにて提供されているカレンダーでは、キーボード操作でカレンダーの日付選択([Enter]キーにて確定、月末よりカーソル移動(右または下矢印キー)で翌月に移動など)を行うことができます。

◎サンプルコード(VB)
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  ' GcDateTime型セルの設定
  Dim gcDateCell As New GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType()
  ' 編集時の書式設定
  gcDateCell.Fields.Clear()
  gcDateCell.Fields.AddRange("yyyy/MM/dd")
  ' 非編集時(表示時)の書式設定
  gcDateCell.DisplayFields.Clear()
  gcDateCell.DisplayFields.AddRange("yyyy/MM/dd")
  gcDateCell.AlternateText.Null.Text = " "
  gcDateCell.AlternateText.DisplayNull.Text = " "
  FpSpread1.ActiveSheet.Columns(1).CellType = gcDateCell
  FpSpread1.ActiveSheet.Columns(1).Width = 90
End Sub


◎サンプルコード(C#)
private void Form1_Load(object sender, EventArgs e)
{
  // GcDateTime型セルの設定
  GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType gcDateCell = new GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType();
  // 編集時の書式設定
  gcDateCell.Fields.Clear();
  gcDateCell.Fields.AddRange("yyyy/MM/dd");
  // 非編集時(表示時)の書式設定
  gcDateCell.DisplayFields.Clear();
  gcDateCell.DisplayFields.AddRange("yyyy/MM/dd");
  gcDateCell.AlternateText.Null.Text = " ";
  gcDateCell.AlternateText.DisplayNull.Text = " ";
  fpSpread1.ActiveSheet.Columns[1].CellType = gcDateCell;
  fpSpread1.ActiveSheet.Columns[1].Width = 90;
}
キーワード
セル型