在c#中的aweb应用程序中的用户控制中应用热(短)密钥 [英] Applying hot(short)key at user contorl in aweb application in c#

查看:57
本文介绍了在c#中的aweb应用程序中的用户控制中应用热(短)密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好...........

我有问题请尽快解决....

我在工作在C#中基于窗口的应用程序。我采取一个用户控制,其中包含许多控制,如按钮,datagridview等。在它的(用户控制)cs页面我们编写了followimg代码...........

Hi to all...........
I have an problem please solve it as soon as....
I am working at window based application in C# . i take a user contol which contains many controles like buttons ,datagridview etc . at it's(user control)cs page we write the followimg code...........

private void UCBookingSlip_KeyDown(object sender, KeyEventArgs e)
       {
           if (e.Alt && e.KeyCode == Keys.C)
           {
               btnCalculate_Click_1(null, EventArgs.Empty);
           }
           else if (e.Alt && e.KeyCode == Keys.O)
           {
               btnOK_Click(null, EventArgs.Empty);
           }
           else if (e.Alt && e.KeyCode == Keys.N)
           {
               mtGradiantButtonNew_Click(null, EventArgs.Empty);
           }
       }



申请短信。但是按键事件不会被解雇。

我在主表单上显示此用户控件。



删除了SHOUTING - OriginalGriff [/ edit]


TO apply short key .but the key press event is not fired.
i'm showing this user control at the master form.

[edit]SHOUTING removed - OriginalGriff[/edit]

推荐答案

通常会发生这种情况,因为其他一些控件会抓住键盘焦点。这样,只处理某些选择控件的键盘事件并没有多大帮助。这只是可能的解决方案之一: http://www.nuget.org/packages/jQuery.Hotkeys/ [ ^ ]。



-SA
Usually it happens because some other control grabs the keyboard focus. This way, just handling keyboard events for some select controls does not really help. This is just one of possible solutions: http://www.nuget.org/packages/jQuery.Hotkeys/[^].

—SA


这篇关于在c#中的aweb应用程序中的用户控制中应用热(短)密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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