Stepper

TsgcHTMLComponent_Stepper — 渲染一个向导 / 步骤进度指示器,带有已完成、当前和即将进行的状态,适用于 Delphi、C++ Builder 和 .NET。

TsgcHTMLComponent_Stepper

一个步骤指示器,发出带有编号圆圈、连接线和每步状态颜色的 Bootstrap 5 标记。添加步骤项目,设置每个项目的 State,然后读取 HTML 属性。

组件类

TsgcHTMLComponent_Stepper

渲染为

Bootstrap 5 步骤 / 向导标记

语言

Delphi, C++ Builder, .NET

创建它、添加步骤、渲染它

添加步骤项目,设置每个 TitleDescriptionState,选择一个 Layout,然后读取 HTML(或将其放入 TsgcHTMLTemplate_Bootstrap 页面)。

uses
  sgcHTML_Enums, sgcHTML_Component_Stepper;

var
  oStepper: TsgcHTMLComponent_Stepper;
  oStep: TsgcHTMLStepItem;
begin
  oStepper := TsgcHTMLComponent_Stepper.Create(nil);
  try
    oStepper.Layout := slHorizontal;
    oStepper.ShowContent := True;
    oStepper.CurrentColorStyle := hcPrimary;

    oStep := oStepper.Items.Add;
    oStep.Title := 'Account';
    oStep.Description := 'Sign in';
    oStep.State := ssCompleted;

    oStep := oStepper.Items.Add;
    oStep.Title := 'Shipping';
    oStep.Description := 'Address';
    oStep.State := ssCurrent;
    oStep.Content := '<p>Enter your delivery address</p>';

    oStep := oStepper.Items.Add;
    oStep.Title := 'Payment';
    oStep.State := ssUpcoming;

    WebModule.Response := oStepper.HTML;   // Bootstrap stepper
  finally
    oStepper.Free;
  end;
end;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Stepper.hpp

TsgcHTMLComponent_Stepper *oStepper = new TsgcHTMLComponent_Stepper(NULL);
try
{
  oStepper->Layout = slHorizontal;
  oStepper->ShowContent = true;
  oStepper->CurrentColorStyle = hcPrimary;

  TsgcHTMLStepItem *oStep = oStepper->Items->Add();
  oStep->Title = "Account";
  oStep->Description = "Sign in";
  oStep->State = ssCompleted;

  oStep = oStepper->Items->Add();
  oStep->Title = "Shipping";
  oStep->Description = "Address";
  oStep->State = ssCurrent;
  oStep->Content = "<p>Enter your delivery address</p>";

  oStep = oStepper->Items->Add();
  oStep->Title = "Payment";
  oStep->State = ssUpcoming;

  String html = oStepper->HTML;   // Bootstrap stepper
}
__finally
{
  delete oStepper;
}
using esegece.sgcWebSockets;

var stepper = new TsgcHTMLComponent_Stepper();
stepper.Layout = TsgcHTMLStepperLayout.slHorizontal;
stepper.ShowContent = true;
stepper.CurrentColorStyle = TsgcHTMLColor.hcPrimary;

var step = stepper.Items.Add();
step.Title = "Account";
step.Description = "Sign in";
step.State = TsgcHTMLStepState.ssCompleted;

step = stepper.Items.Add();
step.Title = "Shipping";
step.Description = "Address";
step.State = TsgcHTMLStepState.ssCurrent;
step.Content = "<p>Enter your delivery address</p>";

step = stepper.Items.Add();
step.Title = "Payment";
step.State = TsgcHTMLStepState.ssUpcoming;

string html = stepper.HTML;   // Bootstrap stepper

关键属性与方法

您最常使用的成员。

步骤

ItemsTsgcHTMLStepItems 集合;Items.Add 返回一个带有 TitleDescriptionContentStateIconTsgcHTMLStepItem

状态

每个步骤的 StatessUpcomingssCurrentssCompleted,驱动圆圈颜色、连接线填充和(配合 ShowContent)当前步骤的面板。

布局

Layout 选择 slHorizontalslVerticalShowContent 在轨道下方渲染活动步骤的 Content

状态颜色

CompletedColorStyleCurrentColorStyleUpcomingColorStyle(每个都是 TsgcHTMLColor)为圆圈着色;*Color 字符串变体用原始十六进制覆盖。

外观

CircleSizeConnectorHeightCompletedIconStepFontSizeStepDescFontSize 调整尺寸和图标。

输出

HTML 返回步骤指示器标记,StepperID 设置其元素 id — 直接提供服务,或将其赋给页面模板的 BodyContent

继续探索

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

准备好开始了吗?

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