想在向StringGrid输入数据的时候,用一个随单元格移动的edit来进行输入,怎样让edit跟着单元格焦点的变化而移动?

解决方案 »

  1.   

    ComboBox1.Visible := False;
    ComboBox1.Left := StringGrid1.Left + StringGrid1.CellRect(ACol, ARow).Left + 2;
    ComboBox1.Top := StringGrid1.Top + StringGrid1.CellRect(ACol, ARow).Top + 1;
    ComboBox1.Height := StringGrid1.RowHeights[ARow] + 3;
    ComboBox1.Width := StringGrid1.ColWidths[ACol] + 4;
    ComboBox1.Visible := True;
      

  2.   

    怎样让edit移动到单元格时显示单元格的内容,改动edit内容是把改动的内容写入相应的单元格呢?
      

  3.   

    要实现你说的功能,不必要用edit吧,在StringGrid的单击事件中加入:procedure TForm1.StringGrid1Click(Sender: TObject);
    begin
    stringgrid1.EditorMode:=true;
    end;
      

  4.   

    up
    我需要用edit来限制输入
      

  5.   

    up
    我需要用edit来限制输入
      

  6.   

    up
    我需要用edit来限制输入
      

  7.   

    procedure TForm1.StringGrid1Click(Sender: TObject);
    var
      ACol,ARow:integer;
    begin
      ComboBox1.Visible := False;
      ACol:=StringGrid1.Col;
      ARow:=StringGrid1.Row;
      ComboBox1.Left := StringGrid1.Left + StringGrid1.CellRect(ACol, ARow).Left + 2;
      ComboBox1.Top := StringGrid1.Top + StringGrid1.CellRect(ACol, ARow).Top + 1;
      ComboBox1.Height := StringGrid1.RowHeights[ARow] + 3;
      ComboBox1.Width := StringGrid1.ColWidths[ACol] + 4;
      ComboBox1.Visible := True;end;
      

  8.   

    怎样让edit移动到单元格时显示单元格的内容,改动edit内容是把改动的内容写入相应的单元格呢?
      

  9.   

    怎样让edit移动到单元格时显示单元格的内容,改动edit内容是把改动的内容写入相应的单元格呢?
      

  10.   

    up
     怎样让edit移动到单元格时显示单元格的内容,改动edit内容是把改动的内容写入相应的单元格呢?