Einzelnen Beitrag anzeigen

sko1

Registriert seit: 27. Jan 2017
577 Beiträge
 
Delphi 10.1 Berlin Enterprise
 
#3

AW: GridPanelLayout mit leeren Zellen?

  Alt 13. Feb 2017, 08:57
stimmt, hier mal ein verkürztes Beispiel, ich erzeuge 100 Zeilen und fülle ab Zeile 5
Delphi-Quellcode:

  for i := 0 to az - 1 do
  begin
    Grid.RowCollection.Add;
    Grid.RowCollection.Items[i].SizeStyle :=
      TGridPanelLayout.TSizestyle.Absolute;
    Grid.RowCollection.Items[i].Value := 50;
    if i > 5 then
    begin
      r := TRectangle.Create(self);
      r.Parent := Grid;
      r.OnClick := RectangleClick;
      r.Align := TAlignLayout.Client;
      r.Tag := i;
      r.Margins.Top := 2;
      r.Margins.Bottom := 2;
      b := TButton.Create(self);
      b.Parent := r;
      b.Height := 30;
      b.Width := 50;
      b.OnClick := ButtonClick;
      b.Position.X := 3;
      b.Position.Y := 3;
      b.Tag := i;
      b.Text := 'test' + i.ToString;
      Grid.ControlCollection.AddControl(r, 0, i);
    end;
  end;
Vielen Dank für Deinen Beispielcode, die Zeile

Grid.ControlCollection.Controls[0, i] := r; anstelle Grid.ControlCollection.AddControl(r, 0, i); löst mein Problem, danke nochmal!

Ciao
Stefan

Geändert von sko1 (13. Feb 2017 um 08:59 Uhr)
  Mit Zitat antworten Zitat