KeyPress或Keyup不触发

问题描述

好吧,我有C#2017净Windows窗体frmFS,KeyPress,KeyDown或Keyup均未触发。 我创建了一个新项目,并选择了用于按键,击键和击键的事件(在每个起作用的函数中都添加了messageboc.show(“ bla”),但是我当前的项目一无所有。如何跟踪问题。

解决方法

假设您正在为@Module({ imports: [ ConfigModule ],providers: [ { provide: APP_GUARD,useClass: ApiKeyGuard } ] }) export class CommonModule implmenets NestModule { configure(consumer: MidlewareConsumer) { consumer.apply(LoggingMiddleware).forRoutes('*') } } KeyDownKeyUp事件使用文本框。

在Visual Studio的设计器中,选择文本框(或您要引用的控件)。

然后在属性窗格中,选择事件标签。

然后查找KeyPressKeyDownKeyPress事件。

如果事件旁边的值为空白,则事件未链接到控件。

enter image description here

您可以双击“值”列以生成事件代码,或者可以查看事件是否出现在下拉列表中(如果已经存在)。

enter image description here

事件方法形式的代码中应可见。

KeyUp