MESCIUS SPREAD for Windows Forms 17.0J サンプルコード集
デフォルトの入力マップを変更する

MESCIUS SPREAD for Windows Forms 17.0J サンプルコード集 > キーボード操作(入力マップ) > デフォルトの入力マップを変更する

例えばアクティブセルへの[Enter]キー押下により、セルは編集状態へと移行します。このデフォルト定義を変更することにより、例えば「次行への移動」とすることも可能です。


 private void Form1_Load(object sender, System.EventArgs e)
 {

   FarPoint.Win.Spread.InputMap im = new FarPoint.Win.Spread.InputMap();

   //非編集セルでの[Enter]キーを「次行へ移動」とします
   im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused);
   im.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow);

   //編集中セルでの[Enter]キーを「次行へ移動」とします
   im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
   im.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow);

 } 
 Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

   Dim im As New FarPoint.Win.Spread.InputMap

   '非編集セルでの[Enter]キーを「次行へ移動」とします
   im = FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused)
   im.Put(New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow)

   '編集中セルでの[Enter]キーを「次行へ移動」とします
   im = FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused)
   im.Put(New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow)

 End Sub