更新时间:2023-12-03 09:59:34
private void FormMain_KeyDown(object sender, KeyEventArgs e)
{
if ((e.KeyCode == Keys.S) && (e.Modifiers == Keys.Control))
checkBoxAck.Checked = !checkBoxAck.Checked;
}
确保将窗体的KeyPreview设置为true.
问候
Make sure that KeyPreview of the form is set to true.
Regards
有两个选项供您选择:
There are two options for you:
Modifier
与Key.Control
(与您在示例中一样,不是 Keys.ControlKey
)进行比较.Modifier
against Key.Control
(not Keys.ControlKey
as you did in your sample).private void frlLOOKUP_KeyDown(object sender, KeyEventArgs e)
{
if (e.Modifiers == Keys.Control && e.KeyCode == Keys.S)
{
check_search.Checked = !check_search.Checked;
}
}
CheckBox
控件的Text
属性设置为"Check& Search"之类的内容. br/>
Text
property of your CheckBox
control to something like "Check&Search".check_search.Text = "Check&Search";
这将允许您通过按 ALT + S 切换复选框.
This will allow you to toggle the CheckBox by pressing ALT + S.
问候,
曼弗雷德(Manfred)
Regards,
Manfred