Delphi dbgird 问题
- 提问者网友:謫仙
- 2021-04-23 17:27
- 五星知识达人网友:忘川信使
- 2021-04-23 18:10
private
OldGridWnd1:TWndMethod;
procedure NewGridWnd1(var Message: TMessage);
procedure TForm1.DataSource1DataChange(Sender: TObject; Field: TField);
begin
edit1.Text:=adoquery1.fieldbyname('name).AsString;
end;
procedure TForm1.NewGridWnd1(var Message: TMessage);
var
IsNeg : Boolean;
begin
if Message.Msg = WM_MOUSEWHEEL then
begin
IsNeg := Short(Message.WParamHi) < 0;
if IsNeg then
DBGrid1.DataSource.DataSet.MoveBy(1)
else
DBGrid1.DataSource.DataSet.MoveBy(-1)
end
else
OldGridWnd1(Message);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
OldGridWnd1 := DBGrid1.WindowProc;
DBGrid1.WindowProc := NewGridWnd1;
end;
- 1楼网友:孤独入客枕
- 2021-04-23 18:44
在dbgrid对应的datasource的ondatachange事件中写