The
void AlignmentView_KeyDown(object sender, KeyEventArgs kea) { switch (kea.KeyData) { case Keys.Left: int xPos = caret.physicalPosition.X / ftWidth - 1; int yPos = caret.physicalPosition.Y / ftHeight-2; MoveCaret(xPos, yPos); UpdateCaret(); kea.Handled = true; break; case Keys.Right: int x = caret.physicalPosition.X / ftWidth + 1; int y = caret.physicalPosition.Y / ftHeight-2; MoveCaret(x, y); UpdateCaret(); kea.Handled = true; break; case Keys.Up: ... break; case Keys.Down: ... break; case Keys.Delete: ... break; case Keys.Back: ... break; case Keys.Insert: ... break; default: ... break; } }