/// <summary> /// 发送结果到焦点 /// </summary> /// <param name="result"></param> private void SendResult(string result) { Application.DoEvents(); System.Threading.Thread.Sleep(100); this.Hide(); inputTypeTemp = inputType; inputType = InputMethodType.InputType.NO; SendKeys.SendWait(result); inputType = inputTypeTemp; // Console.WriteLine("输入法SendResult"); }
private void btnInputType_Click(object sender, EventArgs e) { if (this.inputType == InputMethodType.InputType.CN9) { this.inputType = InputMethodType.InputType.EN; btnInputType.Text = "英"; } else if (this.inputType == InputMethodType.InputType.EN) { this.inputType = InputMethodType.InputType.ENUpper; btnInputType.Text = "大"; } else if (this.inputType == InputMethodType.InputType.ENUpper) { this.inputType = InputMethodType.InputType.NO; btnInputType.Text = "数"; } else if (this.inputType == InputMethodType.InputType.NO) { this.inputType = InputMethodType.InputType.CN9; btnInputType.Text = "中"; } }
/// <summary> /// 输入Key /// </summary> /// <param name="key"></param> public void InputKeys(Keys key) { switch (key) { case Keys.Back: //删除按钮 DeleteKey(); break; case Keys.Right: //选择字 NextChoice(); break; case Keys.Left: //选择字 PreviousChoice(); break; case Keys.Up: //上一页 if (ListResult.Count == 0) //发送光标向上 { KeybdEvent(Keys.Up); } else if (btnPrevious.Enabled) { PreviousPage(); } else if (inputType == InputMethodType.InputType.Symbol) { KeybdEvent(Keys.Up); } break; case Keys.Down: //下一页 if (ListResult.Count == 0) //发送光标向右 { KeybdEvent(Keys.Down); } else if (btnNext.Enabled) { NextPage(); } else if (inputType == InputMethodType.InputType.Symbol) { KeybdEvent(Keys.Down); } break; case Keys.Space: //选择 case Keys.Enter: //选择 if (inputType == InputMethodType.InputType.Symbol) //字符选择 { for (int i = 0; i < symbolMenu.Items.Count; i++) { if (symbolMenu.Items[i].Selected) { GetSymbolSelect(symbolMenu.Items[i].Text); break; } } symbolMenu.Hide(); inputType = InputMethodType.InputType.NO; } else { EnterChoice(key); } break; case Keys.F1: //数字 this.inputType = InputMethodType.InputType.NO; btnInputType.Text = "数"; break; case Keys.F2: //英文 this.inputType = InputMethodType.InputType.EN; btnInputType.Text = "英"; break; case Keys.F3: //中文 this.inputType = InputMethodType.InputType.CN; btnInputType.Text = "中"; break; case Keys.F4: //大写 this.inputType = InputMethodType.InputType.ENUpper; btnInputType.Text = "大"; break; case Keys.F5: //符号 if (this.inputType == InputMethodType.InputType.Symbol) { symbolMenu.Hide(); this.Hide(); this.inputType = InputMethodType.InputType.NO; } else { this.inputType = InputMethodType.InputType.Symbol; ShowSymbolMenu(); } break; case Keys.F7: //大写 if (this.inputType == InputMethodType.InputType.CN) { this.inputType = InputMethodType.InputType.EN; btnInputType.Text = "英"; } else { this.inputType = InputMethodType.InputType.CN; btnInputType.Text = "中"; } break; default: SetInputKey((int)key); break; } }