Panel

TsgcHTMLComponent_Panel — 渲染一个 Bootstrap 卡片面板,带有页眉、主体和页脚,可选地可折叠和可滚动,适用于 Delphi、C++ Builder 和 .NET。

TsgcHTMLComponent_Panel

一个基于 Bootstrap card 构建的盒装内容面板。设置标题和主体,选择颜色,切换可折叠或可滚动,然后读取 HTML 属性。

组件类

TsgcHTMLComponent_Panel

渲染为

Bootstrap 5 card 标记

语言

Delphi, C++ Builder, .NET

创建它、设置内容、渲染它

赋值 TitleBodyFooter,选择一个 Color,然后读取 HTML — 或使用静态的一行 Build 辅助方法。

uses
  sgcHTML_Enums, sgcHTML_Component_Panel;

var
  oPanel: TsgcHTMLComponent_Panel;
begin
  oPanel := TsgcHTMLComponent_Panel.Create(nil);
  try
    oPanel.Title := 'Account Summary';
    oPanel.Body := '<p>Your plan renews on the 1st.</p>';
    oPanel.Footer := 'Last updated today';
    oPanel.Color := hcLight;
    oPanel.Collapsible := True;
    oPanel.Expanded := True;

    WebModule.Response := oPanel.HTML;   // Bootstrap card
  finally
    oPanel.Free;
  end;
end;

// Or in a single line with the static helper:
Result := TsgcHTMLComponent_Panel.Build('Account Summary',
  '<p>Your plan renews on the 1st.</p>', hcLight, 'Last updated today');
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Panel.hpp

TsgcHTMLComponent_Panel *oPanel = new TsgcHTMLComponent_Panel(NULL);
try
{
  oPanel->Title = "Account Summary";
  oPanel->Body = "<p>Your plan renews on the 1st.</p>";
  oPanel->Footer = "Last updated today";
  oPanel->Color = hcLight;
  oPanel->Collapsible = true;
  oPanel->Expanded = true;

  String html = oPanel->HTML;   // Bootstrap card
}
__finally
{
  delete oPanel;
}

// Or in a single line with the static helper:
String html = TsgcHTMLComponent_Panel::Build("Account Summary",
  "<p>Your plan renews on the 1st.</p>", hcLight, "Last updated today");
using esegece.sgcWebSockets;

var panel = new TsgcHTMLComponent_Panel();
panel.Title = "Account Summary";
panel.Body = "<p>Your plan renews on the 1st.</p>";
panel.Footer = "Last updated today";
panel.Color = TsgcHTMLColor.hcLight;
panel.Collapsible = true;
panel.Expanded = true;

string html = panel.HTML;   // Bootstrap card

// Or in a single line with the static helper:
string oneLine = TsgcHTMLComponent_Panel.Build("Account Summary",
    "<p>Your plan renews on the 1st.</p>", TsgcHTMLColor.hcLight, "Last updated today");

关键属性与方法

您最常使用的成员。

内容

Title 设置卡片页眉,Body 设置主体 HTML 内容,Footer 设置可选的页脚行。

外观

ColorTsgcHTMLColor)选择主题颜色;Outline 渲染带边框的变体,而非填充背景。

折叠

Collapsible 将页眉变成一个切换开关,Expanded 设置主体是否默认展开。

滚动

Scrollable 配合 MaxHeight 限制主体高度,并为长内容添加垂直滚动。

标识

PanelID 为卡片分配一个明确的 DOM id,用作折叠目标的锚点。

一行构建

Build(aTitle, aBody, aColor, aFooter) 通过单个静态调用返回面板 HTML;HTML 渲染已配置的实例。

继续探索

所有 sgcHTML 组件浏览 60 多个组件的完整功能矩阵。
下载免费试用版30 天试用版附带 60.HTML 演示项目。
价格Single、Team 和 Site 授权,均含完整源代码。

准备好开始了吗?

下载免费试用版,开始在 Delphi、C++ Builder 和 .NET 中构建 Web 界面。