![]() |
StringGrid nach StrigGrid
Wie kopiere ich in zwei unterschiedlichen Form's ein Grid in ein anderes Grid..........
beide heißen StringGrid2, das eine in der Form1 und das andere in der Form 2......... |
Re: StringGrid nach StrigGrid
In etwa so:
Delphi-Quellcode:
MfG
var i, j: Integer;
begin Form2.StringGrid2.ColCount:= Form1.StringGrid2.ColCount; Form2.StringGrid2.RowCount:= Form1.StringGrid2.RowCount; for i:=0 to Form1.StringGrid2.ColCount-1 do for j:=0 to Form1.StringGrid2.RowCount-1 do Form2.StringGrid2.Cells[i,j]:= Form1.StringGrid2.Cells[i,j]; end; Binärbaum |
Re: StringGrid nach StrigGrid
Hai Binärbaum,
das ganze müsste auch mit einer Schleife gehen ;-)
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var ndx : Integer; begin Form2.StringGrid2.ColCount:= Form1.StringGrid2.ColCount; Form2.StringGrid2.RowCount:= Form1.StringGrid2.RowCount; for ndx := 0 to StringGrid1.RowCount do begin Form2.StringGrid1.Rows[ndx] := Form1.StringGrid1.Rows[ndx]; end; end; |
Re: StringGrid nach StrigGrid
Zitat:
|
Re: StringGrid nach StrigGrid
imho werden da Speicherbereiche kopiert. Rows ist vom Typ TStrings. Daher sollte das schneller sein.
Das gleiche ginge auch mit Cols. Da man meistens weniger Cols als Rows hat wäre es damit vermutlich noch schneller. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:39 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz