Autor Beitrag
duffbartman
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Do 27.10.05 08:13 
Guten Morgen ;)

Ich benötige eure Hilfe! Ich habe einige Cellen/Zeilen im StringGrid1 mit diesem Code ausgeblendet

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
procedure Tform1.details;
var
  j: integer;
begin
  for j := 0 to stringgrid1.RowCount-1  do
  begin
    if not cb_details.Checked then
    begin
      if (stringgrid1.cells[0, j] = ('01:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('02:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('03:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('04:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('05:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('06:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('07:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('08:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('09:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('10:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('11:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('12:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('13:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('14:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('15:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('16:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('17:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('18:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('19:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('20:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('21:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('22:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('23:00:00')) then
            stringgrid1.RowHeights[j] := 0;
      if (stringgrid1.cells[0, j] = ('00:00:00')) then
            stringgrid1.RowHeights[j] := 0;
    end
    else
        stringgrid1.RowHeights[j] := 21;
  end;
end;


Nun möchte ich jetzt alle nun sichtbaren Zeilen in ein weiteres StringGrid kopieren!! Stehe aber so früh am morgen auf der Leitung. Hat jemand einen Tipp für mich??

Danke
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 27.10.05 08:46 
Moin!

Wie wäre es mit der Abfrage: .RowHeights[] <> 0? :wink:

cu
Narses
duffbartman Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Do 27.10.05 09:10 
aber klar doch!!! :autsch:

habs jetzt so gemacht...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
  itemp:=0;
  tmpsg.RowCount := stringGrid1.RowCount-1;  // zeilen anpassen
  tmpsg.ColCount := stringGrid1.ColCount-1;  // spalten anpassen


for i:=0 to Stringgrid1.RowCount-1 do
    begin
     if stringGrid1.RowHeights[i] <> 0 then
      begin
       for j:= 0 to stringGrid1.ColCount-1 do
         tmpsg.Cells[j,itemp] := Stringgrid1.Cells[j,i];
         itemp:=itemp+1;
       end;
     end;
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Do 27.10.05 10:15 
Hallo,

in dem Fall kannst Du auch direkt mit rows arbeiten, dann brauchst Du nicht jede einzelne Zelle ins andere Grid schreiben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var z,itemp: Integer;
begin
  itemp:=0;
  //...
  for z := 0 to StringGrid1.RowCount-1 do
    if StringGrid1.RowHeights[z] <> 0 then
      begin
      StringGrid2.Rows[itemp] := StringGrid1.Rows[z];//<--------
      inc(itemp);
      end;

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
duffbartman Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Do 27.10.05 10:27 
danke gut zu wissen :!: :wink: