Z zjrivaldo Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-24 #1 请问各位怎么才能使用dbgrid在可编辑的情况下,用向下光标键移动最后一条记录时不使 dbgrid自动增加一行。谢谢!
X xeen Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-24 #3 截获键盘消息,在onkeydown事件中判断一下。 if (key = vk_down) and (dbgrid.datasource.dataset.eof) then key := 0;
B blues hu Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-24 #4 option中的dgediting改为false就行了
X xeen Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-25 #6 Sorry 上面那个有误: procedure TForm1.DBGrid1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); var tempgrid:TStringGrid; begin tempgrid := TStringGrid(dbgrid1); if (key = vk_down) and (tempgrid.Selection.Top = dbgrid1.DataSource.DataSet.RecordCount-2 )then key := 0; end;
Sorry 上面那个有误: procedure TForm1.DBGrid1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); var tempgrid:TStringGrid; begin tempgrid := TStringGrid(dbgrid1); if (key = vk_down) and (tempgrid.Selection.Top = dbgrid1.DataSource.DataSet.RecordCount-2 )then key := 0; end;