CNAS取数仪器端升级
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
870B

  1. using System.Windows.Forms;
  2. namespace CnasSynchronousCommon
  3. {
  4. public class FormKeyEventClass
  5. {
  6. /// <summary>
  7. /// 声明一个委托
  8. /// </summary>
  9. public delegate void FormKey();
  10. /// <summary>
  11. /// 声明事件对象
  12. /// </summary>
  13. public event FormKey FormKeyEvent;
  14. /// <summary>
  15. /// 事件触发方法
  16. /// </summary>
  17. protected virtual void OnEvent(KeyEventArgs e)
  18. {
  19. if (FormKeyEvent != null && e.KeyCode == Keys.Enter)
  20. {
  21. FormKeyEvent();
  22. }
  23. }
  24. /// <summary>
  25. /// 引发事件的方法(一般是由外部调用的方法,用来引发事件发生)
  26. /// </summary>
  27. public void FormKeyEventRun(KeyEventArgs e)
  28. {
  29. OnEvent(e);
  30. }
  31. }
  32. }