作成日: 2017/02/15 最終更新日: 2017/02/15
文書種別
使用方法
詳細
InputManセル(GcCharMask/GcComboBox/GcDateTime/GcMask/GcNumber/GcTextBox/GcTimeSpan型セル)は、InputMan for Windows Formsをもとにした入力コントールを提供しているため、通常のセル型よりも複雑な構成になっています。
以下の実装例では、GcDateTimeCellTypeの基底クラスであらかじめフィールドやサイドボタンを実装する実装例を紹介しています。
◎サンプルコード(VB)
◎サンプルコード(C#)
以下の実装例では、GcDateTimeCellTypeの基底クラスであらかじめフィールドやサイドボタンを実装する実装例を紹介しています。
◎サンプルコード(VB)
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
FpSpread1.ActiveSheet.Columns(0).CellType = New MyGcDateTimeCellType()
End Sub
' InputManセル(GcDateTimeCellType)を継承したセル型
<System.ComponentModel.LicenseProviderAttribute(GetType(System.ComponentModel.LicenseProvider))>
Public Class MyGcDateTimeCellType
Inherits GrapeCity.Win.Spread.InputMan.CellType.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 GrapeCity.Win.Spread.InputMan.CellType.DropDownButtonInfo())
Me.SideButtons.Add(New GrapeCity.Win.Spread.InputMan.CellType.SpinButtonInfo())
End Sub
Private Function ShouldSerializeSideButtons() As Boolean
Return False
End Function
End Class
FpSpread1.ActiveSheet.Columns(0).CellType = New MyGcDateTimeCellType()
End Sub
' InputManセル(GcDateTimeCellType)を継承したセル型
<System.ComponentModel.LicenseProviderAttribute(GetType(System.ComponentModel.LicenseProvider))>
Public Class MyGcDateTimeCellType
Inherits GrapeCity.Win.Spread.InputMan.CellType.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 GrapeCity.Win.Spread.InputMan.CellType.DropDownButtonInfo())
Me.SideButtons.Add(New GrapeCity.Win.Spread.InputMan.CellType.SpinButtonInfo())
End Sub
Private Function ShouldSerializeSideButtons() As Boolean
Return False
End Function
End Class
◎サンプルコード(C#)
private void Form1_Load(object sender, EventArgs e)
{
fpSpread1.ActiveSheet.Columns[0].CellType = new MyGcDateTimeCellType();
}
// InputManセル(GcDateTimeCellType)を継承したセル型
[LicenseProviderAttribute(typeof(LicenseProvider))]
public class MyGcDateTimeCellType : GrapeCity.Win.Spread.InputMan.CellType.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());
//【修正後】
this.SideButtons.Add(new GrapeCity.Win.Spread.InputMan.CellType.DropDownButtonInfo());
this.SideButtons.Add(new GrapeCity.Win.Spread.InputMan.CellType.SpinButtonInfo());
}
private bool ShouldSerializeSideButtons()
{
return false;
}
}
{
fpSpread1.ActiveSheet.Columns[0].CellType = new MyGcDateTimeCellType();
}
// InputManセル(GcDateTimeCellType)を継承したセル型
[LicenseProviderAttribute(typeof(LicenseProvider))]
public class MyGcDateTimeCellType : GrapeCity.Win.Spread.InputMan.CellType.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());
//【修正後】
this.SideButtons.Add(new GrapeCity.Win.Spread.InputMan.CellType.DropDownButtonInfo());
this.SideButtons.Add(new GrapeCity.Win.Spread.InputMan.CellType.SpinButtonInfo());
}
private bool ShouldSerializeSideButtons()
{
return false;
}
}
旧文書番号
39946