键盘回车,光标左移而不是下移

 

重写方法 ProcessCmdKey 就可以了

 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        
{
            
if ((!(ActiveControl is Button)) && (keyData == Keys.Up || keyData == Keys.Down || keyData == Keys.Enter))
            
{
                
if (keyData == Keys.Enter)
                
{
                    SendKeys.Send(
"{TAB}");
                    
return true;
                }

                
if (keyData == Keys.Down)
                
{
                    SendKeys.Send(
"{TAB}");
                }

                
else
                
{
                    SendKeys.Send(
"+{TAB}");
                }

                
return true;
            }

            
else
                
return base.ProcessCmdKey(ref msg, keyData);
        }
posted @ 2006-12-26 17:03  jhtchina  阅读(780)  评论(0)    收藏  举报