将KeyPress事件与DblClick事件组合在一起 [英] Combine a KeyPress event with a DblClick event

查看:83
本文介绍了将KeyPress事件与DblClick事件组合在一起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我有一个文本框的双击事件,它会在触发时将默认值放入其中。


我希望能够按''Ctrl''+双击以输入不同的值。


我知道还有其他方法可以实现这一点,但是我的一位键盘迷同事提出了这个建议,我想我会检查是否可能,因为我的努力失败了(关于我想的任何一个事件,我都不太了解。


谢谢...

Hi everybody,

I have a double click event for a text box that will put a default value in it when fired.

I''d like to be able to press ''Ctrl'' + double click to put in a different value.

I know there are others ways of accomplishing this, but it was suggested by one of my keyboard junkie coworkers and I thought I check to see if it was possible because my efforts have failed (I don''t know enough about either event I suppose)

Thanks...

推荐答案

这应该可以帮到你出。只需使用表单上的控件名称替换控件名称即可。您还必须将表单的Key Preview属性设置为Yes。

This should help you out. Just replace the control names with whatever the control names are on your form. You will also have to set the Key Preview property of the form to Yes.

展开 | 选择 | Wrap | 行号


保存班次MouseDown中的状态并将其应用于DblClick事件过程。当然,用If替换Debug.Print。 。 。然后或选择案例iShift。 。 。结束选择。

Save the shift status from the MouseDown and apply it in the DblClick event procedure. Of course, replace Debug.Print with If . . . Then or Select Case iShift . . . End Select.

展开 | 选择 | Wrap | 行号


事后的想法 - 您可以再次双击。 DblClick事件将检查当前值,如果是第一个默认值,则将其更改为第二个默认值。然后不必放下咖啡。
An afterthought - you could double-click a second time. The DblClick event would check the current value, and if the 1st default, change it to the 2nd default value. Wouldn''t have to put down the coffee then.


这篇关于将KeyPress事件与DblClick事件组合在一起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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