AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Flowpanel geeignetes Control ?

Ein Thema von v2afrank · begonnen am 29. Jan 2018 · letzter Beitrag vom 18. Mär 2024
Antwort Antwort
Der schöne Günther

Registriert seit: 6. Mär 2013
6.211 Beiträge
 
Delphi 10 Seattle Enterprise
 
#1

AW: Flowpanel geeignetes Control ?

  Alt 29. Jan 2018, 10:40
BeginUpdate()/EndUpdate() ohne try..finally ist aber auch mutig.
  Mit Zitat antworten Zitat
CarlAshnikov

Registriert seit: 18. Feb 2011
Ort: Erfurt
108 Beiträge
 
Delphi XE5 Enterprise
 
#2

AW: Flowpanel geeignetes Control ?

  Alt 29. Jan 2018, 10:51
Das ist richtig, ich schrieb aber auch gebastelt

Hier die verbesserte Variante:
Delphi-Quellcode:
procedure TForm2.AddControlsToGridPanel(AGridPanel: TGridPanel; ARows, ACols: integer;
  AControls: TArray<TControl>);
var
  i: integer;
begin
  Assert(ARows * ACols = Length(AControls));
  AGridPanel.ControlCollection.Clear;
  with AGridPanel do
  begin
    ColumnCollection.BeginUpdate;
    try
      if ColumnCollection.Count <> ACols then
      begin
        ColumnCollection.Clear;
        for i := 0 to ACols - 1 do
          ColumnCollection.Add.Value := 50;
      end;
    finally
      ColumnCollection.EndUpdate;
    end;

    RowCollection.BeginUpdate;
    try
      if RowCollection.Count <> ARows then
      begin
        RowCollection.Clear;
        for i := 0 to ARows - 1 do
          RowCollection.Add.Value := 50;
      end;
    finally
      RowCollection.EndUpdate;
    end;
  end;

  for i := Low(AControls) to High(AControls) do
  begin
    AControls[i].Parent := AGridPanel;
    AControls[i].Align := alClient;
  end;
end;
Sebastian
Das kann ja wohl nicht var sein!
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:01 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