は、基本的には、キーボードであることと、私は私がしました...耳を傾け、彼らは特定のパターンであったように、これらのキー入力を扱うことができます
キーを押してパターン...
;123123?
は私がtehのメインフォームレベルでキーを押して気づくには、次のコードを書いた......えっ次いけない、そしてオープン/適切なフォームフィールドを集中";"に。その後、他のすべてのキーを押して "?"これを「入力」とします。
private void EPOSForm_KeyDown(object sender, KeyEventArgs e) {
//this captures ";" and gives focus to the member ref for input also escape key
if (e.KeyValue == 186 || e.KeyValue == 27) {
textBox.Focus();
}
}
private void textBox_KeyDown(object sender, KeyEventArgs e) {
//this captures ";" and ignores it
if (e.KeyValue == 186 || e.KeyValue == 191 || e.KeyValue == 27)
return;
}
private void textBox_TextChanged(object sender, EventArgs e) {
if (textBox.Text.IndexOf(";") != -1) {
//prevents typing of the last char
textBox.Text = textBox.Text.Replace(";", "");
textBox.Focus();
textBox.SelectionStart = textBox.Text.Length;
}
if (textBox.Text.IndexOf("?") != -1) {
//prevents typing of the last char, but assumes it mean "enter"
textBox.Text = textBox.Text.Replace("?", "");
textBox.Focus();
textBox.SelectionStart = textBox.Text.Length;
//click button
}
}
こんにちはバリーとあなたの答えに感謝します。たぶん私の質問は少し曖昧でした、私は画面上ではなく、スキャナのディスプレイ上にテキストを表示することを望んでいませんでした。あなたはスキャナにエスケープシーケンスを送ることができるはずですが、動作させることができません。マイクロソフトポイントオブサービス1.14を使ってどのように手がかりをつけることができるのか? – stgus