Placeholder
TsgcHTMLComponent_Placeholder — 渲染一个带微光动画的 Bootstrap 5 骨架加载卡片,行数、图片、标题和按钮均可配置,适用于 Delphi、C++ Builder 和 .NET。
TsgcHTMLComponent_Placeholder — 渲染一个带微光动画的 Bootstrap 5 骨架加载卡片,行数、图片、标题和按钮均可配置,适用于 Delphi、C++ Builder 和 .NET。
一个骨架加载器组件,发出带有发光或波浪微光效果的 Bootstrap 5 placeholder 标记。设置行数和要显示的部分,然后读取 HTML 属性 — 或调用静态的 BuildCard / BuildText 辅助方法。
TsgcHTMLComponent_Placeholder
Bootstrap 5 placeholder 标记
Delphi, C++ Builder, .NET
调用 BuildCard(lineCount, animation) 可获得完整的骨架卡片,或创建组件、设置 LineCount、ShowImage 和 Animation,然后读取 HTML。
uses
sgcHTML_Enums, sgcHTML_Component_Placeholder;
// One-line static helper (primary form):
var
vHTML: string;
begin
vHTML := TsgcHTMLComponent_Placeholder.BuildCard(3, paWave);
WebModule.Response := vHTML;
end;
// Or configure it fully:
var
oPH: TsgcHTMLComponent_Placeholder;
begin
oPH := TsgcHTMLComponent_Placeholder.Create(nil);
try
oPH.LineCount := 4;
oPH.Animation := paGlow;
oPH.Color := hcSecondary;
oPH.ShowImage := True;
oPH.ShowTitle := True;
oPH.ShowButtons := True;
WebModule.Response := oPH.HTML; // Bootstrap placeholder card
finally
oPH.Free;
end;
end;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Placeholder.hpp
// One-line static helper (primary form):
String html = TsgcHTMLComponent_Placeholder::BuildCard(3, paWave);
// Or configure it fully:
TsgcHTMLComponent_Placeholder *oPH = new TsgcHTMLComponent_Placeholder(NULL);
try
{
oPH->LineCount = 4;
oPH->Animation = paGlow;
oPH->Color = hcSecondary;
oPH->ShowImage = true;
oPH->ShowTitle = true;
oPH->ShowButtons = true;
String body = oPH->HTML; // Bootstrap placeholder card
}
__finally
{
delete oPH;
}
using esegece.sgcWebSockets;
// One-line static helper (primary form):
string html = TsgcHTMLComponent_Placeholder.BuildCard(3,
TsgcHTMLPlaceholderAnimation.paWave);
// Or configure it fully:
var ph = new TsgcHTMLComponent_Placeholder();
ph.LineCount = 4;
ph.Animation = TsgcHTMLPlaceholderAnimation.paGlow;
ph.Color = TsgcHTMLColor.hcSecondary;
ph.ShowImage = true;
ph.ShowTitle = true;
ph.ShowButtons = true;
string body = ph.HTML; // Bootstrap placeholder card
您最常使用的成员。
LineCount 设置渲染多少行占位文本(默认 3),宽度各异以模拟真实文案。
Animation 通过 TsgcHTMLPlaceholderAnimation 选择 paGlow 或 paWave 微光效果。
ShowImage 添加图片块,ShowTitle 添加标题栏,ShowButtons 添加两个按钮占位符。
Size 用 phSmall、phNormal、phLarge 或 phExtraLarge 设置占位符高度;Color 接受一个 TsgcHTMLColor。
BuildCard(lineCount, animation) 返回一个完整的骨架卡片;BuildText(lineCount, animation) 仅返回文本行;BuildButton(animation) 返回单个按钮。
HTML 返回完整的 Bootstrap 占位卡片 — 一旦您的数据加载完成,即可将其替换为真实内容。