ProgressBar コンポーネント — sgcHTML | eSeGeCe

ProgressBar

TsgcHTMLComponent_ProgressBar — Delphi、C++ Builder、.NET で、任意のラベルを備えたストライプ・アニメーション付きの Bootstrap プログレスバー、またはスタック型のマルチセグメントバーです。

TsgcHTMLComponent_ProgressBar

単一バーには ValueMax を設定し、スタック型のマルチセグメントバーには Bars にエントリーを追加してから、HTML プロパティを読み取ります。

コンポーネントクラス

TsgcHTMLComponent_ProgressBar

レンダリング内容

Bootstrap 5 の .progress バー(単一またはスタック型)

言語

Delphi, C++ Builder, .NET

値を設定し、スタイルを適用し、レンダリングする

ValueMaxColorStyle を設定し、必要に応じて Striped / Animated / ShowLabel を有効にしてから、HTML を読み取ります。

uses
  sgcHTML_Enums, sgcHTML_Component_ProgressBar;

var
  oBar: TsgcHTMLComponent_ProgressBar;
begin
  oBar := TsgcHTMLComponent_ProgressBar.Create(nil);
  try
    oBar.ProgressBarID := 'upload';
    oBar.Value := 72;
    oBar.Max := 100;
    oBar.ColorStyle := hcSuccess;
    oBar.Striped := True;
    oBar.Animated := True;
    oBar.ShowLabel := True;
    oBar.LabelFormat := '%d%% complete';

    WebModule.Response := oBar.HTML;   // Bootstrap progress bar
  finally
    oBar.Free;
  end;
end;

// Or a stacked, multi-segment bar:
with oBar.Bars.Add do
begin
  Value := 40;
  ColorStyle := hcPrimary;
  Label_ := 'Done';
end;
with oBar.Bars.Add do
begin
  Value := 20;
  ColorStyle := hcWarning;
  Label_ := 'In progress';
end;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_ProgressBar.hpp

TsgcHTMLComponent_ProgressBar *oBar = new TsgcHTMLComponent_ProgressBar(NULL);
try
{
  oBar->ProgressBarID = "upload";
  oBar->Value = 72;
  oBar->Max = 100;
  oBar->ColorStyle = hcSuccess;
  oBar->Striped = true;
  oBar->Animated = true;
  oBar->ShowLabel = true;
  oBar->LabelFormat = "%d%% complete";

  String html = oBar->HTML;   // Bootstrap progress bar

  // Or a stacked, multi-segment bar:
  TsgcHTMLProgressBarItem *oSeg1 = oBar->Bars->Add();
  oSeg1->Value = 40;
  oSeg1->ColorStyle = hcPrimary;
  oSeg1->Label_ = "Done";

  TsgcHTMLProgressBarItem *oSeg2 = oBar->Bars->Add();
  oSeg2->Value = 20;
  oSeg2->ColorStyle = hcWarning;
  oSeg2->Label_ = "In progress";
}
__finally
{
  delete oBar;
}
using esegece.sgcWebSockets;

var bar = new TsgcHTMLComponent_ProgressBar();
bar.ProgressBarID = "upload";
bar.Value = 72;
bar.Max = 100;
bar.ColorStyle = TsgcHTMLColor.hcSuccess;
bar.Striped = true;
bar.Animated = true;
bar.ShowLabel = true;
bar.LabelFormat = "%d%% complete";

string html = bar.HTML;   // Bootstrap progress bar

// Or a stacked, multi-segment bar:
var seg1 = bar.Bars.Add();
seg1.Value = 40;
seg1.ColorStyle = TsgcHTMLColor.hcPrimary;
seg1.Label_ = "Done";

var seg2 = bar.Bars.Add();
seg2.Value = 20;
seg2.ColorStyle = TsgcHTMLColor.hcWarning;
seg2.Label_ = "In progress";

主なプロパティとメソッド

最もよく使うメンバーです。

Single bar

ValueMax(デフォルト 100)は塗りつぶし幅をパーセンテージで設定します。ColorStyle は Bootstrap の色を選択し、Color で任意の CSS カラーを直接指定することもできます。

Label

ShowLabel はバー内にパーセンテージテキストをレンダリングします。LabelFormat(デフォルト %d%%)はその書式を制御します。

Striped & animated

Striped は斜めのストライプを追加します。Animated はストライプを含意し、バー全体でアニメーションさせます。

Stacked segments

Bars.AddTsgcHTMLProgressBarItemValueColorStyle / ColorLabel_)を追加します。Bars にエントリーがあると、単一の Value バーの代わりに使用されます。

Sizing & identity

Height はカスタムの CSS バー高さを設定します。ProgressBarID(または ElementID)は、フラグメントのプッシュ用に外側の <div class="progress"> に名前を付けます。

Output

HTML はプログレスラッパーとそのバーセグメントを返し、埋め込んだり、値の変化に応じて WebSocket 経由でプッシュしたりできます。

さらに詳しく

オンラインヘルプこのコンポーネントの完全な API リファレンスと使用ガイドです。
すべての sgcHTML コンポーネント80 以上のコンポーネントの全機能マトリックスを閲覧できます。
無料体験版のダウンロード30 日間の体験版には 60.HTML デモプロジェクトが付属します。
価格完全なソースコード付きの Single、Team、Site ライセンス。

始める準備はできましたか?

無料体験版をダウンロードして、Delphi、C++ Builder、.NET の Web アプリにプログレスバーを追加しましょう。