作成日: 2022/01/21 最終更新日: 2022/02/24
文書種別
使用方法
詳細
コンボボックス型セルでのドロップダウンリスト表示~終了の間には以下の順番でイベントが発生します。
選択後の値を取得する場合には(3)ComboCloseUpイベントをご利用ください。
◎サンプルコード(VB)
◎サンプルコード(C#)
(1)ComboDropDownイベント
ドロップダウンリストを表示したタイミング
(2)ComboSelChangeイベント
ドロップダウンリスト上の選択項目を変更したタイミング(選択確定ではありません)
(3)ComboCloseUpイベント
ドロップダウンリストを閉じたタイミング(選択確定)
ドロップダウンリストを表示したタイミング
(2)ComboSelChangeイベント
ドロップダウンリスト上の選択項目を変更したタイミング(選択確定ではありません)
(3)ComboCloseUpイベント
ドロップダウンリストを閉じたタイミング(選択確定)
選択後の値を取得する場合には(3)ComboCloseUpイベントをご利用ください。
◎サンプルコード(VB)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim c As New FarPoint.Win.Spread.CellType.ComboBoxCellType
c.Items = New String() {"aaa", "bbb", "ccc"}
FpSpread1.ActiveSheet.Cells(0, 0).CellType = c
End Sub
Private Sub FpSpread1_ComboDropDown(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.EditorNotifyEventArgs) Handles FpSpread1.ComboDropDown
Console.WriteLine("ComboDropDownイベント時の値:" + FpSpread1.ActiveSheet.Cells(0, 0).Value)
End Sub
Private Sub FpSpread1_ComboSelChange(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.EditorNotifyEventArgs) Handles FpSpread1.ComboSelChange
Console.WriteLine("ComboSelChangeイベント時の値:" + FpSpread1.ActiveSheet.Cells(0, 0).Value)
End Sub
Private Sub FpSpread1_ComboCloseUp(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.EditorNotifyEventArgs) Handles FpSpread1.ComboCloseUp
Console.WriteLine("ComboCloseUpイベント時の値:" + FpSpread1.ActiveSheet.Cells(0, 0).Value)
End Sub
Dim c As New FarPoint.Win.Spread.CellType.ComboBoxCellType
c.Items = New String() {"aaa", "bbb", "ccc"}
FpSpread1.ActiveSheet.Cells(0, 0).CellType = c
End Sub
Private Sub FpSpread1_ComboDropDown(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.EditorNotifyEventArgs) Handles FpSpread1.ComboDropDown
Console.WriteLine("ComboDropDownイベント時の値:" + FpSpread1.ActiveSheet.Cells(0, 0).Value)
End Sub
Private Sub FpSpread1_ComboSelChange(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.EditorNotifyEventArgs) Handles FpSpread1.ComboSelChange
Console.WriteLine("ComboSelChangeイベント時の値:" + FpSpread1.ActiveSheet.Cells(0, 0).Value)
End Sub
Private Sub FpSpread1_ComboCloseUp(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.EditorNotifyEventArgs) Handles FpSpread1.ComboCloseUp
Console.WriteLine("ComboCloseUpイベント時の値:" + FpSpread1.ActiveSheet.Cells(0, 0).Value)
End Sub
◎サンプルコード(C#)
private void Form1_Load(object sender, EventArgs e)
{
FarPoint.Win.Spread.CellType.ComboBoxCellType c = new FarPoint.Win.Spread.CellType.ComboBoxCellType();
c.Items = new string[] { "aaa", "bbb", "ccc" };
fpSpread1.ActiveSheet.Cells[0, 0].CellType = c;
}
void fpSpread1_ComboDropDown(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
{
Console.WriteLine("ComboDropDownイベント時の値:" + fpSpread1.ActiveSheet.Cells[0, 0].Value);
}
void fpSpread1_ComboSelChange(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
{
Console.WriteLine("ComboSelChangeイベント時の値:" + fpSpread1.ActiveSheet.Cells[0, 0].Value);
}
void fpSpread1_ComboCloseUp(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
{
Console.WriteLine("ComboCloseUpイベント時の値:" + fpSpread1.ActiveSheet.Cells[0, 0].Value);
}
{
FarPoint.Win.Spread.CellType.ComboBoxCellType c = new FarPoint.Win.Spread.CellType.ComboBoxCellType();
c.Items = new string[] { "aaa", "bbb", "ccc" };
fpSpread1.ActiveSheet.Cells[0, 0].CellType = c;
}
void fpSpread1_ComboDropDown(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
{
Console.WriteLine("ComboDropDownイベント時の値:" + fpSpread1.ActiveSheet.Cells[0, 0].Value);
}
void fpSpread1_ComboSelChange(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
{
Console.WriteLine("ComboSelChangeイベント時の値:" + fpSpread1.ActiveSheet.Cells[0, 0].Value);
}
void fpSpread1_ComboCloseUp(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
{
Console.WriteLine("ComboCloseUpイベント時の値:" + fpSpread1.ActiveSheet.Cells[0, 0].Value);
}