通过按键执行链接标签单击
我试图在按下“A”键时为链接标签创建一个事件。按下“B”键时也是如此,依此类推,直到按下“Z”。链接标签的名称是 ALinkLabel
根据我的研究,我认为它看起来有点像这样
private void ALinkLabel_KeyPressed(object sender, KeyEventArg e)
{
something in there
}
,我不太确定,对于 C# 来说是新手。
任何见解将不胜感激
I'm trying to create an event for a link label when the 'A' key is pressed. and the same when 'B' key is pressed, and so on until 'Z'. The name of the linklabel is ALinkLabel
From what I've researched, I think it would look a bit something like this
private void ALinkLabel_KeyPressed(object sender, KeyEventArg e)
{
something in there
}
I'm not exactly sure, new to C#.
Any insight would be greatly appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您将需要处理父表单/用户控件上的 KeyPressed,然后使用
为了找到匹配的 LinkLabel,您可以考虑将绑定字母存储在链接标签控件的
Tag
属性中。You are going to instead want to handle the KeyPressed on the parent form / user control and then use the
PerformClick
of the appropriate LinkLabel after casting it to IButtonControl.In order to find the matching LinkLabel you might consider storing the bound letter in the link label control's
Tag
property.看来您正在尝试在按下按键或其他操作时更改标签的文本!
请参阅此处:http://social.msdn.microsoft.com/Forums/da-DK/winforms/thread/b2c7bdd0-6204-4ced-b3d9-6101925b06ed
It seems you are trying to change text of a label when keys are pressed or something!
refer here: http://social.msdn.microsoft.com/Forums/da-DK/winforms/thread/b2c7bdd0-6204-4ced-b3d9-6101925b06ed