Placeholder

TsgcHTMLComponent_Placeholder — 渲染一个带微光动画的 Bootstrap 5 骨架加载卡片,行数、图片、标题和按钮均可配置,适用于 Delphi、C++ Builder 和 .NET。

TsgcHTMLComponent_Placeholder

一个骨架加载器组件,发出带有发光或波浪微光效果的 Bootstrap 5 placeholder 标记。设置行数和要显示的部分,然后读取 HTML 属性 — 或调用静态的 BuildCard / BuildText 辅助方法。

组件类

TsgcHTMLComponent_Placeholder

渲染为

Bootstrap 5 placeholder 标记

语言

Delphi, C++ Builder, .NET

一行代码构建,或完整配置它

调用 BuildCard(lineCount, animation) 可获得完整的骨架卡片,或创建组件、设置 LineCountShowImageAnimation,然后读取 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 选择 paGlowpaWave 微光效果。

区块

ShowImage 添加图片块,ShowTitle 添加标题栏,ShowButtons 添加两个按钮占位符。

外观

SizephSmallphNormalphLargephExtraLarge 设置占位符高度;Color 接受一个 TsgcHTMLColor

静态辅助方法

BuildCard(lineCount, animation) 返回一个完整的骨架卡片;BuildText(lineCount, animation) 仅返回文本行;BuildButton(animation) 返回单个按钮。

输出

HTML 返回完整的 Bootstrap 占位卡片 — 一旦您的数据加载完成,即可将其替换为真实内容。

继续探索

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

准备好开始了吗?

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