如按一下button1.光标自动跳到dbgrid的某一个字段中。字段拥用焦点如何表示?

解决方案 »

  1.   

    Query.Frist;
    TDrawGrid(DBGrid1).Col:=1;
    DBGrid1.setFocus;
    第一行第一列
      

  2.   

    容易dbgrid1.DataSource.DataSet.Fields[i].FocusControl;其中i表示你要的字段数!比如1,2,3,等
      

  3.   

    dbgrid1.SetFocus;
      dbgrid1.SelectedIndex:=0;
      

  4.   

    dbgrid1.SetFocus;
    dbgrid1.SelectedIndex:=i;//i为你想要自动拥有焦点的那个字段在dbgrid中的顺序索引号
      

  5.   

    DBGridKeyPress
    begin
    if key=#13 then
    if DBGrid1.selectedinedx<(DBGrid1.fieldcount-1) then
    DBGrid1.selectedindex:=DBGrid1.selectedindex+1;
    else
    begin
    if not table1.eof then
    begin
    table1.next;
    DBGrid1.SelectedIndex:=0;
    end;
    end;
    end;