Vielleicht sollte man sich die Selection merken:
Delphi-Quellcode:
type
PGridRect = ^TGridRect;
procedure TDemoForm.FormCreate(Sender: TObject);
begin
StringGrid1.Tag := Integer(New(PGridRect));
StringGrid2.Tag := Integer(New(PGridRect));
end;
procedure TDemoForm.FormDestroy(Sender: TObject);
begin
Dispose(PGridRect(StringGrid1.Tag));
Dispose(PGridRect(StringGrid2.Tag));
end;
procedure TDemoForm.StringGridEnter(Sender: TObject);
begin
with Sender as TStringGrid do
Selection := PGridRect(Tag)^;
end;
procedure TDemoForm.StringGridExit(Sender: TObject);
begin
with Sender as TStringGrid do
begin
PGridRect(Tag)^ := Selection;
Selection := TGridRect(Rect(-1, -1, -1, -1));
end;
end;
Grüße vom marabu