在 DBGrid 中如何让回车变为光标右移动

时间:2020-05-16 16:46:41   收藏:0   阅读:47

在Form.OnKeyPress事件中写如下代码:

  if Key = #13 then 
  if ActiveControl = DBGrid1 then begin 
    TDBGrid(ActiveControl).SelectedIndex := TDBGrid(ActiveControl).SelectedIndex + 1; 
    Key := #0; 
end; 

有2点需要注意:
  1.当光标达到DBGird最右列的时候,再按回车,光标还会停留在原地。
  2.Key := #0

原文:https://www.cnblogs.com/jijm123/p/12900815.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!