InputManセル(GcDateTimeCellType)を継承する方法

文書番号 : 38938     文書種別 : 使用方法     登録日 : 2015/07/01     最終更新日 : 2015/07/01
文書を印刷する
対象製品
SPREAD for Windows Forms 8.0J
詳細
InputManセル(GcTextBoxCellType,GcDateTimeCellType)は、InputMan for Windows Formsをもとにした入力コントールを提供しているため、通常のセル型よりも複雑な構成になっています。
以下の実装例では、GcDateTimeCellTypeの基底クラスであらかじめフィールドやサイドボタンを実装する実装例を紹介しています。


◎サンプルコード(VB)
' ライセンス属性を設定します。
<LicenseProviderAttribute(GetType(LicenseProvider))> _
Public Class MyGcDateTimeCellType
  Inherits InputManCell.GcDateTimeCellType
  Public Sub New()
    ' 最初にフィールドなどを消去します。
    Me.Fields.Clear()
    Me.DisplayFields.Clear()
    Me.SideButtons.Clear()

    ' フィールドなどを初期化します。
    initializeCollections()
  End Sub

  ' フィールドなどを初期化します。
  Private Sub initializeCollections()
    Me.Fields.AddRange("yyyy/MM/dd")
    Me.DisplayFields.AddRange("yyyy/M/d")
    Me.SideButtons.Add(New InputManCell.DropDownButtonInfo())
    Me.SideButtons.Add(new InputManCell.SpinButtonInfo());
  End Sub

  Private Function ShouldSerializeSideButtons() As Boolean
    Return False
  End Function
End Class


◎サンプルコード(C#)
// ライセンス属性を設定します。
[LicenseProviderAttribute(typeof(LicenseProvider))]
public class MyGcDateTimeCellType : InputManCell.GcDateTimeCellType
{
  public MyGcDateTimeCellType()
  {
    // 最初にフィールドなどを消去します。
    this.Fields.Clear();
    this.DisplayFields.Clear();
    this.SideButtons.Clear();

    // フィールドなどを初期化します。
    initializeCollections();
  }

  // フィールドなどを初期化します。
  private void initializeCollections()
  {
    this.Fields.AddRange("yyyy/MM/dd");
    this.DisplayFields.AddRange("yyyy/M/d");
    this.SideButtons.Add(new InputManCell.DropDownButtonInfo());
    this.SideButtons.Add(new InputManCell.SpinButtonInfo());
  }

  private bool ShouldSerializeSideButtons()
  {
    return false;
  }
}
キーワード
セル型