procedure TForm1.FormCreate(Sender: TObject); var i: integer; begin HeaderControl1.Sections.Items[2].Width := HeaderControl1.Width - { } (HeaderControl1.Sections.Items[0].Width + HeaderControl1.Sections.Items[1].Width + HeaderControl1.Sections.Items[3].Width + HeaderControl1.Sections.Items[4].Width); // SetLength(MyCards, 5); // for i := low(MyCards) to high(MyCards) do CreateNewCard(i); // CurrentCardOnPanel := 0; MyCards[CurrentCardOnPanel].Visible := true; end;
procedure TForm1.HeaderControl1SectionClick(HeaderControl: THeaderControl; Section: THeaderSection); var a, b: TPanel; begin case Section.ID of 0: begin begin if (Length(MyCards) > 0) then begin if CurrentCardOnPanel <= high(MyCards) then begin MyCards[CurrentCardOnPanel].Visible := false; // MyCards[CurrentCardOnPanel].Free; Delete(MyCards, CurrentCardOnPanel, 1); end; // if Length(MyCards) > 0 then begin if CurrentCardOnPanel <= high(MyCards) then MyCards[CurrentCardOnPanel].Visible := true else begin if (CurrentCardOnPanel + 1) <= high(MyCards) then begin inc(CurrentCardOnPanel); MyCards[CurrentCardOnPanel].Visible := true; end else begin CurrentCardOnPanel := high(MyCards); MyCards[CurrentCardOnPanel].Visible := true; end; end; end; end; end; end; 1: begin if ((CurrentCardOnPanel - 1) >= 0) then begin MyCards[CurrentCardOnPanel].Visible := false; dec(CurrentCardOnPanel); MyCards[CurrentCardOnPanel].Visible := true; end; end; 2: MyCardNames; 3: begin if ((CurrentCardOnPanel + 1) < Length(MyCards)) then begin MyCards[CurrentCardOnPanel].Visible := false; inc(CurrentCardOnPanel); MyCards[CurrentCardOnPanel].Visible := true; end; end; 4: begin SetLength(MyCards, Length(MyCards) + 1); // CreateNewCard(high(MyCards)); // CurrentCardOnPanel := high(MyCards); MyCards[CurrentCardOnPanel].Visible := true; end; end; end;
procedure TForm1.MyCardNames; begin Memo1.Lines.Clear; // for var MyCard in MyCards do Memo1.Lines.Add('Card name=[' + MyCard.Name + '] Tag=' + MyCard.Tag.ToString); end;
(* procedure TForm1.OrganizeCardsByCardTag; begin TArray.Sort<TPanel>(MyCards, TDelegatedComparer<TPanel>.Construct( function(const Left, Right: TPanel): integer begin Result := TComparer<integer>.Default.Compare(Left.Tag, Right.Tag); end)); end; *)
end.
此帖子包含附件: 大小:117.5K
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3