您现在的位置:软界网技术中心软件开发Delphi > 技术显示
Delphi三十六之数据库篇
2001-1-12 0:00:00   网友评论       阅读次数 点此评论
   1.在TDBGrid中将Enter键用作Tab键

  //设置窗体的KeyPreview为True

procedure TForm1.FormKeyPress(Sender: Tobject; var Key: Char);

 begin
  if Key = #13 then
  if not (ActiveControl is TDBGrid) then
   begin
    Key := #0;
    Perform(WM_NEXTDLGCTL, 0, 0);
  end
 
 else
  if (ActiveControl is TDBGrid) then
   with TDBGrid(ActiveControl) do
  if selectedindex $#@60; (fieldcount -1) then
   selectedindex := selectedindex +1
  else
   selectedindex := 0;

  end;

  2.删除记录前显示汉语的提示对话框

  //设置DbNavigator的ConfirmDelete属性为False
  //在数据集控件的BeforeDelete事件中编写如下代码:

if Application.MessageBox('确定要删除当前记录吗?', '删除 记录', Mb_YesNo + Mb_IconWarning) =
Id_No then
Abort; //利用哑异常退出删除事件
共2页。 1 2 8 :
 
      来源: 作者:
 
【评论查看】