当前位置:首页 > Windows程序 > 正文

Windows Form小技巧

2021-03-12 Windows程序

在TextBox获取焦点时,如果按下Enter或者Esc键会有让人很烦躁的错误提示音,,在你的Form类中加入这个函数会有帮助。

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.Enter || keyData == Keys.Escape) return true;
return base.ProcessCmdKey(ref msg, keyData);
}

Windows Form小技巧

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/60018.html