开发者

How to Capture keydown event of a Label?

I added the event, I click in the label and press any key, but it doest go to the method. How can I captur开发者_C百科e?


I don't think labels can receive keyboard input. It will go to the control with focus, and labels can never have focus (by default, I guess you might pull some shenanigans though), most likely your events are going to your main form.


Maybe you could disguise a text box to look like a label.


To add content beyond my other comment. Have you looked at something like input bindings for what you are trying to do?

http://msdn.microsoft.com/en-us/library/system.windows.input.inputbinding.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜