Panel
TsgcHTMLComponent_Panel — 渲染一个 Bootstrap 卡片面板,带有页眉、主体和页脚,可选地可折叠和可滚动,适用于 Delphi、C++ Builder 和 .NET。
TsgcHTMLComponent_Panel — 渲染一个 Bootstrap 卡片面板,带有页眉、主体和页脚,可选地可折叠和可滚动,适用于 Delphi、C++ Builder 和 .NET。
一个基于 Bootstrap card 构建的盒装内容面板。设置标题和主体,选择颜色,切换可折叠或可滚动,然后读取 HTML 属性。
赋值 Title、Body 和 Footer,选择一个 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 设置可选的页脚行。
Color(TsgcHTMLColor)选择主题颜色;Outline 渲染带边框的变体,而非填充背景。
Collapsible 将页眉变成一个切换开关,Expanded 设置主体是否默认展开。
Scrollable 配合 MaxHeight 限制主体高度,并为长内容添加垂直滚动。
PanelID 为卡片分配一个明确的 DOM id,用作折叠目标的锚点。
Build(aTitle, aBody, aColor, aFooter) 通过单个静态调用返回面板 HTML;HTML 渲染已配置的实例。