作成日: 2017/07/26 最終更新日: 2017/07/26
文書種別
使用方法
詳細
MultiRowではデザイナを使用してセルのフォーカスの移動順序(タブオーダー)を指定できます。MultiRowは設計時に作成したテンプレートのレイアウトを、実行時に繰り返し表示するため、行ごとに異なるタブオーダーを指定することはできません。
行ごと、セルごと、または実行時の他の条件に応じてセルのフォーカスの移動先を変更するにはGcMultiRow.NewCellPositionNeededイベントを使用します。
[Visual Basic]
[C#]
NewCellPositionNeededイベントはマウス関連のイベントよりも先に発生するため、ユーザーがクリックしたセルを優先することはできません。NewCellPositionNeededイベントを使用する場合にクリック操作も反映するには、次のようにコーディングします。
[Visual Basic]
[C#]
行ごと、セルごと、または実行時の他の条件に応じてセルのフォーカスの移動先を変更するにはGcMultiRow.NewCellPositionNeededイベントを使用します。
[Visual Basic]
Imports GrapeCity.Win.MultiRow Private Sub GcMultiRow1_NewCellPositionNeeded(ByVal sender As System.Object, ByVal e As GrapeCity.Win.MultiRow.NewCellPositionNeededEventArgs) Handles GcMultiRow1.NewCellPositionNeeded ' 移動元のセルのインデックスが0のとき、セルのインデックス3に移動します If e.CellIndex = 0 Then e.NewCellPosition = New CellPosition(e.RowIndex, 3) End Sub
[C#]
using GrapeCity.Win.MultiRow;
private void gcMultiRow1_NewCellPositionNeeded(object sender, NewCellPositionNeededEventArgs e)
{
// 移動元のセルのインデックスが0のとき、セルのインデックス3に移動します
if (e.CellIndex == 0) e.NewCellPosition = new CellPosition(e.RowIndex, 3);
}
NewCellPositionNeededイベントはマウス関連のイベントよりも先に発生するため、ユーザーがクリックしたセルを優先することはできません。NewCellPositionNeededイベントを使用する場合にクリック操作も反映するには、次のようにコーディングします。
[Visual Basic]
Imports GrapeCity.Win.MultiRow Private Sub GcMultiRow1_CellMouseClick(ByVal sender As System.Object, _ ByVal e As CellMouseEventArgs) Handles GcMultiRow1.CellMouseClick Dim gcMultiRow As GcMultiRow = TryCast(sender, GcMultiRow) Dim pos As CellPosition = New CellPosition(e.RowIndex, e.CellIndex) If Not gcMultiRow.CurrentCellPosition = pos Then gcMultiRow.CurrentCellPosition = pos End If End Sub
[C#]
using GrapeCity.Win.MultiRow;
private void gcMultiRow1_CellMouseClick(object sender, CellMouseEventArgs e)
{
GcMultiRow gcMultiRow = sender as GcMultiRow;
CellPosition pos = new CellPosition(e.RowIndex, e.CellIndex);
if (gcMultiRow.CurrentCellPosition != pos)
{
gcMultiRow.CurrentCellPosition = pos;
}
}
旧文書番号
40594