用“回车”键代替“Tab”键

编辑器加载中...

//首先将窗体的 keypreview 的属性设为 true
 
private void 窗体_KeyPress( object sender, KeyPressEventArgs e)
{
    if ( e.KeyChar == ( char )13 )
    {
        this .SelectNextControl( this .ActiveControl, true , true , false , true );
    }
}
 
//或
 
private void Form1_KeyDown( object sender, KeyEventArgs e)
{
    if ( e.KeyData == Keys.Enter )
    {
        this .SelectNextControl( this .ActiveControl, true , true , false , true );
    }
}

你可能感兴趣的:(tab)