使功能键功能可在整个应用程序中使用 [英] Make Function Key Functionality Available Across whole Application

查看:77
本文介绍了使功能键功能可在整个应用程序中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

当我在VB.net中开发应用程序时.我想在所有应用程序工作期间将功能键定义为全局,即F1为帮助键,F2为客户组合,F3为发票明细,依此类推.当我在MDI父窗体中定义所有键时,但它在MDI窗体中起作用仅在程序的其余部分中不起作用.

PL指南.

谢谢,

Jatin gupta.

Dear All,

As I''m developing the application in VB.net. I want to define my function Key as Global during all the Application working i.e F1 as help key, F2 as Customer Combo, F3 as Invoice Detail and so on. As I define all the key in MDI Parent Form but it function in the MDI form Only not in the rest of the program.

Pl guide.

Thanks,

Jatin gupta.

推荐答案

AFAIK没有做到这一点的简单"方法,但是有可能.
方法1-Windows消息队列
复杂且难以维护/理解,但这具有在一个地方"的优势.这是参考资料
MSDN Windows消息和消息队列 [
AFAIK there is no "simple" way to do this, but it is possible.

Method 1- Windows Message Queue
Complicated and more difficult to maintain/understand, but this has the advantage of "being in one place". Here is a reference
MSDN Windows Message and Message Queues[^]

  • Hook into the windows queue from the main form
  • Catch all Function key presses for the current application from the queue (don''t forget to handle!)

  • 为表单添加一个子菜单,并添加一个按下功能键(传递键号)时触发的事件
  • 在子类化表单中,请挂接功能键,以便它们在上述步骤中调用该事件
  • 在子类中,自动订阅创建的子表单的功能键事件,并在子表单触发时重新引发
  • 从子类派生所有表单
  • 在主[root]表单中,订阅顶级功能键事件,然后将所需的功能放入处理方法中

  • Sublcass a form and add an event that fires when a function key is pressed (passing the key number
  • In the subclassed form hook up the function keys so they call the event in the above step
  • In the subclass, automatically subscribe into created child form''s Function key event, and re-raise if child form fires
  • Derive all forms from the subclass
  • In the main [root] form, subscribe into the top function key event and put the desired functionality into the handling method


这篇关于使功能键功能可在整个应用程序中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆