如何才能点 Button1 = 点一下 DBCtrlGrid1 的向上滚动
点 Button2 = 点一下 DBCtrlGrid1 的向下滚动
请给出源码!

解决方案 »

  1.   

    来个差点的算法先
    假设DBCtrlGrid1一次显示5条记录procedure TForm1.Button1Click(Sender: TObject);
    var
    w:integer;
    begin
    for w:= 1 to 5 do Table1.Next
    end;procedure TForm1.Button2Click(Sender: TObject);
    var
    w:integer;
    begin
    for w:= 1 to 5 do Table1.Prior;
    end;
      

  2.   

    DoKey method (TDBCtrlGrid)
    DescriptionCall DoKey to perform the operation specified by the Key parameter. For example, use DoKey to remap keystrokes from an OnKeyDown event handler.The actions performed for the different values of Key are given in the following tableValue ActiongkNull Do nothing.
    gkEditMode Toggle the EditMode property.
    gkPriorTab Move to the previous panel.
    gkNextTab Move to the next panel.
    gkLeft Move one panel to the left.
    gkRight Move one panel to the right.
    gkUp Move one panel up.
    gkDown Move one panel down.
    gkScrollUp Move one panel up.
    gkScrollDown Move one panel down.
    gkPageUp Move ColCount * RowCount records up in the dataset.
    gkPageDown Move ColCount * RowCount records down in the dataset.
    gkHome Move to the first record in the dataset.gkEnd Move to the last record in the dataset.
    gkInsert Insert a new record prior to the current record in the dataset and set EditMode to true.
    gkAppend Insert a new record at the end of the dataset and set EditMode to true.
    gkDelete Delete the current record from the dataset and set EditMode to false.
    gkCancel Cancel any edits not written to the dataset and set EditMode to false.