Ver Mensaje Individual
  #2  
Antiguo 18-02-2018
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola.

Fijate si este ejemplo con tres TStringGrid te resulta útil:
Código Delphi [-]
...
type
  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    StringGrid2: TStringGrid;
    StringGrid3: TStringGrid;
    procedure FormCreate(Sender: TObject);
    procedure sgTopLeftChanged(Sender: TObject);
  private
  public
  end;

var
  Form1: TForm1;

implementation {$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
  i: Integer;
begin
  StringGrid1.ColCount := 3;
  StringGrid1.RowCount := 10;
  StringGrid2.ColCount := 3;
  StringGrid2.RowCount := 10;
  StringGrid3.ColCount := 3;
  StringGrid3.RowCount := 10;

  for i := 0 to StringGrid1.RowCount-1 do
  begin
    StringGrid1.Rows[i].CommaText := IntToStr(i)+','+IntToStr(i+1)+','+IntToStr(i+2);
    StringGrid2.Rows[i].CommaText := StringGrid1.Rows[i].CommaText;
    StringGrid3.Rows[i].CommaText := StringGrid1.Rows[i].CommaText;
  end;

  StringGrid1.OnTopLeftChanged := sgTopLeftChanged;
  StringGrid2.OnTopLeftChanged := sgTopLeftChanged;
  StringGrid3.OnTopLeftChanged := sgTopLeftChanged;
end;

procedure TForm1.sgTopLeftChanged(Sender: TObject);
var
  i : Integer;
begin
  for i := 0 to ControlCount-1 do
    if (Controls[i] is TStringGrid)and(Controls[i] <> Sender) then
      TStringGrid(Controls[i]).TopRow := TStringGrid(Sender).TopRow
end;
Funciona con mouse sobre el ScrollBar tanto como con las teclas down/up.

Salida:


Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita