form的 keypreview设为true
private void SmtpForm_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar==(char)13)
{
this.SelectNextControl(this.ActiveControl,true,true,false,true);
}
}
private void SmtpForm_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar==(char)13)
{
this.SelectNextControl(this.ActiveControl,true,true,false,true);
}
}
博客介绍了在C#里,将form的keypreview设为true,并给出了按键事件处理代码。当按下回车键(KeyChar为13)时,会选择下一个控件。
923

被折叠的 条评论
为什么被折叠?



