Sections
Sections divide the panel content area into labelled horizontal bands. Each section can be given a Text label, a fixed Size (height in pixels), and an optional Control that is automatically positioned and sized to fill the section.
Adding sections
var
S: TTMSFNCPanelSection;
begin
TMSFNCPanel1.BeginUpdate;
try
TMSFNCPanel1.Sections.Clear;
S := TMSFNCPanel1.Sections.Add;
S.Text := 'Name';
S.Size := 40;
S := TMSFNCPanel1.Sections.Add;
S.Text := 'Address';
S.Size := 40;
S := TMSFNCPanel1.Sections.Add;
S.Text := 'Notes';
// Last section with no fixed size stretches to fill the remainder
finally
TMSFNCPanel1.EndUpdate;
end;
end;
Sections stack from top to bottom. If the total section height is less than the panel content area, the last section stretches to fill the remainder. Set Size to a positive value to fix the height.
Assigning controls to sections
var
Section: TTMSFNCPanelSection;
begin
Section := TMSFNCPanel1.Sections.Add;
Section.Text := 'Name';
Section.Size := 40;
Section.Control := NameEdit; // NameEdit.Parent must be the panel
end;
The assigned control is resized and repositioned automatically whenever the panel is resized.
Section appearance
All sections share the SectionsAppearance settings:
TMSFNCPanel1.SectionsAppearance.Fill.Color := $00F5F5F5;
TMSFNCPanel1.SectionsAppearance.Stroke.Color := $00CCCCCC;
TMSFNCPanel1.SectionsAppearance.Font.Size := 11;