Selaa lähdekoodia

ProgressBar Added Caption, CaptionShowPercent, CaptionShowPercentAlign, CaptionShowPercentDigits; Changed Values to Double Type; Deleted Unit BGRADrawerFlashProgressBar; New Test with all Features

ProgressBar
 Added Caption, CaptionShowPercent, CaptionShowPercentAlign, CaptionShowPercentDigits;
 Changed Values to Double Type;
 Deleted Unit BGRADrawerFlashProgressBar;
 New Test with all Features
Massimo Magnano 11 kuukautta sitten
vanhempi
sitoutus
e8a3267ea8
6 muutettua tiedostoa jossa 977 lisäystä ja 1077 poistoa
  1. 72 76
      bgracontrols.lpk
  2. 13 22
      bgracontrols.pas
  3. 0 449
      bgradrawerflashprogressbar.pas
  4. 574 188
      bgraflashprogressbar.pas
  5. 234 291
      test/test_progressbar/umain.lfm
  6. 84 51
      test/test_progressbar/umain.pas

+ 72 - 76
bgracontrols.lpk

@@ -34,7 +34,7 @@
     <Description Value="BGRA Controls is a set of graphical UI elements that you can use with Lazarus LCL applications."/>
     <License Value="Modified LGPL"/>
     <Version Major="9" Release="1" Build="6"/>
-    <Files Count="81">
+    <Files Count="80">
       <Item1>
         <Filename Value="atshapelinebgra.pas"/>
         <HasRegisterProc Value="True"/>
@@ -249,187 +249,183 @@
         <UnitName Value="BGRACustomDrawn"/>
       </Item44>
       <Item45>
-        <Filename Value="bgradrawerflashprogressbar.pas"/>
-        <UnitName Value="BGRADrawerFlashProgressBar"/>
-      </Item45>
-      <Item46>
         <Filename Value="bgraflashprogressbar.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAFlashProgressBar"/>
-      </Item46>
-      <Item47>
+      </Item45>
+      <Item46>
         <Filename Value="bgragraphiccontrol.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAGraphicControl"/>
-      </Item47>
-      <Item48>
+      </Item46>
+      <Item47>
         <Filename Value="bgraimagelist.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAImageList"/>
-      </Item48>
-      <Item49>
+      </Item47>
+      <Item48>
         <Filename Value="bgraimagemanipulation.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAImageManipulation"/>
-      </Item49>
-      <Item50>
+      </Item48>
+      <Item49>
         <Filename Value="bgraimagetheme.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAImageTheme"/>
-      </Item50>
-      <Item51>
+      </Item49>
+      <Item50>
         <Filename Value="bgraknob.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAKnob"/>
-      </Item51>
-      <Item52>
+      </Item50>
+      <Item51>
         <Filename Value="bgraresizespeedbutton.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAResizeSpeedButton"/>
-      </Item52>
-      <Item53>
+      </Item51>
+      <Item52>
         <Filename Value="bgrashape.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAShape"/>
-      </Item53>
-      <Item54>
+      </Item52>
+      <Item53>
         <Filename Value="bgraspeedbutton.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRASpeedButton"/>
-      </Item54>
-      <Item55>
+      </Item53>
+      <Item54>
         <Filename Value="bgraspriteanimation.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRASpriteAnimation"/>
-      </Item55>
-      <Item56>
+      </Item54>
+      <Item55>
         <Filename Value="bgrasvgimagelist.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRASVGImageList"/>
-      </Item56>
-      <Item57>
+      </Item55>
+      <Item56>
         <Filename Value="bgrasvgtheme.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRASVGTheme"/>
-      </Item57>
-      <Item58>
+      </Item56>
+      <Item57>
         <Filename Value="bgratheme.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRATheme"/>
-      </Item58>
-      <Item59>
+      </Item57>
+      <Item58>
         <Filename Value="bgrathemebutton.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAThemeButton"/>
-      </Item59>
-      <Item60>
+      </Item58>
+      <Item59>
         <Filename Value="bgrathemecheckbox.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAThemeCheckBox"/>
-      </Item60>
-      <Item61>
+      </Item59>
+      <Item60>
         <Filename Value="bgrathemeradiobutton.pas"/>
         <HasRegisterProc Value="True"/>
         <AddToUsesPkgSection Value="False"/>
         <UnitName Value="BGRAThemeRadioButton"/>
-      </Item61>
-      <Item62>
+      </Item60>
+      <Item61>
         <Filename Value="bgravirtualscreen.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAVirtualScreen"/>
-      </Item62>
-      <Item63>
+      </Item61>
+      <Item62>
         <Filename Value="colorspeedbutton.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="ColorSpeedButton"/>
-      </Item63>
-      <Item64>
+      </Item62>
+      <Item63>
         <Filename Value="dtanalogclock.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="DTAnalogClock"/>
-      </Item64>
-      <Item65>
+      </Item63>
+      <Item64>
         <Filename Value="dtanalogcommon.pas"/>
         <UnitName Value="DTAnalogCommon"/>
-      </Item65>
-      <Item66>
+      </Item64>
+      <Item65>
         <Filename Value="dtanaloggauge.pas"/>
         <HasRegisterProc Value="True"/>
         <AddToUsesPkgSection Value="False"/>
         <UnitName Value="DTAnalogGauge"/>
-      </Item66>
-      <Item67>
+      </Item65>
+      <Item66>
         <Filename Value="dtthemedclock.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="dtthemedclock"/>
-      </Item67>
-      <Item68>
+      </Item66>
+      <Item67>
         <Filename Value="dtthemedgauge.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="dtthemedgauge"/>
-      </Item68>
-      <Item69>
+      </Item67>
+      <Item68>
         <Filename Value="materialcolors.pas"/>
         <UnitName Value="MaterialColors"/>
-      </Item69>
-      <Item70>
+      </Item68>
+      <Item69>
         <Filename Value="bgrasvgimagelistform/bgrasvgimagelistform.pas"/>
         <UnitName Value="bgrasvgimagelistform"/>
-      </Item70>
-      <Item71>
+      </Item69>
+      <Item70>
         <Filename Value="bclealcddisplay.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BCLeaLCDDisplay"/>
-      </Item71>
-      <Item72>
+      </Item70>
+      <Item71>
         <Filename Value="bclealed.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BCLeaLED"/>
-      </Item72>
-      <Item73>
+      </Item71>
+      <Item72>
         <Filename Value="bcleaqled.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BCLeaQLED"/>
-      </Item73>
-      <Item74>
+      </Item72>
+      <Item73>
         <Filename Value="bclearingslider.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BCLeaRingSlider"/>
-      </Item74>
-      <Item75>
+      </Item73>
+      <Item74>
         <Filename Value="bcleaselector.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BCLeaSelector"/>
-      </Item75>
-      <Item76>
+      </Item74>
+      <Item75>
         <Filename Value="bcleatheme.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BCLeaTheme"/>
-      </Item76>
-      <Item77>
+      </Item75>
+      <Item76>
         <Filename Value="bclealcddisplay_editorregister.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BCLeaLCDDisplay_EditorRegister"/>
-      </Item77>
-      <Item78>
+      </Item76>
+      <Item77>
         <Filename Value="bcleaboard.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BCLeaBoard"/>
-      </Item78>
-      <Item79>
+      </Item77>
+      <Item78>
         <Filename Value="bcleaengrave.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BCLeaEngrave"/>
-      </Item79>
-      <Item80>
+      </Item78>
+      <Item79>
         <Filename Value="supergauge.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="supergauge"/>
-      </Item80>
-      <Item81>
+      </Item79>
+      <Item80>
         <Filename Value="supergaugecommon.pas"/>
         <UnitName Value="supergaugecommon"/>
-      </Item81>
+      </Item80>
     </Files>
     <CompatibilityMode Value="True"/>
     <LazDoc Paths="fpdoc"/>

+ 13 - 22
bgracontrols.pas

@@ -8,24 +8,17 @@ unit bgracontrols;
 interface
 
 uses
-  atshapelinebgra, BCButton, BCButtonFocus, BCCheckComboBox, BCComboBox, 
-  BCEffect, BCExpandPanels, bcfilters, BCFluentProgressRing, BCFluentSlider, 
-  BCGameGrid, BCGradientButton, BCImageButton, BCLabel, BCListBox, 
-  BCListBoxEx, BCMaterialDesignButton, BCMaterialEdit, 
-  BCMaterialFloatSpinEdit, BCMaterialProgressBarMarquee, BCMaterialSpinEdit, 
-  BCMDButton, BCMDButtonFocus, BCPanel, BCRadialProgressBar, BCRoundedImage, 
-  BCRTTI, BCSamples, BCStylesForm, BCSVGButton, BCSVGViewer, BCToolBar, 
-  BCTrackbarUpdown, BGRAColorTheme, bgracontrolsinfo, BGRACustomDrawn, 
-  BGRADrawerFlashProgressBar, BGRAFlashProgressBar, BGRAGraphicControl, 
-  BGRAImageList, BGRAImageManipulation, BGRAImageTheme, BGRAKnob, 
-  BGRAResizeSpeedButton, BGRAShape, BGRASpeedButton, BGRASpriteAnimation, 
-  BGRASVGImageList, BGRASVGTheme, BGRATheme, BGRAThemeButton, 
-  BGRAThemeCheckBox, BGRAThemeRadioButton, BGRAVirtualScreen, 
-  ColorSpeedButton, DTAnalogClock, DTAnalogCommon, DTAnalogGauge, 
-  dtthemedclock, dtthemedgauge, MaterialColors, bgrasvgimagelistform, 
-  BCLeaLCDDisplay, BCLeaLED, BCLeaQLED, BCLeaRingSlider, BCLeaSelector, 
-  BCLeaTheme, BCLeaLCDDisplay_EditorRegister, BCLeaBoard, BCLeaEngrave, 
-  supergauge, supergaugecommon, LazarusPackageIntf;
+  atshapelinebgra, BCButton, BCButtonFocus, BCCheckComboBox, BCComboBox, BCEffect, BCExpandPanels, bcfilters, 
+  BCFluentProgressRing, BCFluentSlider, BCGameGrid, BCGradientButton, BCImageButton, BCLabel, BCListBox, BCListBoxEx, 
+  BCMaterialDesignButton, BCMaterialEdit, BCMaterialFloatSpinEdit, BCMaterialProgressBarMarquee, BCMaterialSpinEdit, 
+  BCMDButton, BCMDButtonFocus, BCPanel, BCRadialProgressBar, BCRoundedImage, BCRTTI, BCSamples, BCStylesForm, 
+  BCSVGButton, BCSVGViewer, BCToolBar, BCTrackbarUpdown, BGRAColorTheme, bgracontrolsinfo, BGRACustomDrawn, 
+  BGRAFlashProgressBar, BGRAGraphicControl, BGRAImageList, BGRAImageManipulation, BGRAImageTheme, BGRAKnob, 
+  BGRAResizeSpeedButton, BGRAShape, BGRASpeedButton, BGRASpriteAnimation, BGRASVGImageList, BGRASVGTheme, BGRATheme, 
+  BGRAThemeButton, BGRAThemeCheckBox, BGRAThemeRadioButton, BGRAVirtualScreen, ColorSpeedButton, DTAnalogClock, 
+  DTAnalogCommon, DTAnalogGauge, dtthemedclock, dtthemedgauge, MaterialColors, bgrasvgimagelistform, BCLeaLCDDisplay, 
+  BCLeaLED, BCLeaQLED, BCLeaRingSlider, BCLeaSelector, BCLeaTheme, BCLeaLCDDisplay_EditorRegister, BCLeaBoard, 
+  BCLeaEngrave, supergauge, supergaugecommon, LazarusPackageIntf;
 
 implementation
 
@@ -47,8 +40,7 @@ begin
   RegisterUnit('BCMaterialDesignButton', @BCMaterialDesignButton.Register);
   RegisterUnit('BCMaterialEdit', @BCMaterialEdit.Register);
   RegisterUnit('BCMaterialFloatSpinEdit', @BCMaterialFloatSpinEdit.Register);
-  RegisterUnit('BCMaterialProgressBarMarquee', 
-    @BCMaterialProgressBarMarquee.Register);
+  RegisterUnit('BCMaterialProgressBarMarquee', @BCMaterialProgressBarMarquee.Register);
   RegisterUnit('BCMaterialSpinEdit', @BCMaterialSpinEdit.Register);
   RegisterUnit('BCMDButton', @BCMDButton.Register);
   RegisterUnit('BCMDButtonFocus', @BCMDButtonFocus.Register);
@@ -89,8 +81,7 @@ begin
   RegisterUnit('BCLeaRingSlider', @BCLeaRingSlider.Register);
   RegisterUnit('BCLeaSelector', @BCLeaSelector.Register);
   RegisterUnit('BCLeaTheme', @BCLeaTheme.Register);
-  RegisterUnit('BCLeaLCDDisplay_EditorRegister', 
-    @BCLeaLCDDisplay_EditorRegister.Register);
+  RegisterUnit('BCLeaLCDDisplay_EditorRegister', @BCLeaLCDDisplay_EditorRegister.Register);
   RegisterUnit('BCLeaBoard', @BCLeaBoard.Register);
   RegisterUnit('BCLeaEngrave', @BCLeaEngrave.Register);
   RegisterUnit('supergauge', @supergauge.Register);

+ 0 - 449
bgradrawerflashprogressbar.pas

@@ -1,449 +0,0 @@
-unit BGRADrawerFlashProgressBar;
-
-{$mode objfpc}{$H+}
-
-interface
-
-uses
-  Classes, {$IFDEF BGRABITMAP_USE_MSEGUI} mclasses, {$ENDIF} SysUtils, Types, BGRABitmap, BGRABitmapTypes, BGRAGraphics, BGRAGradients,
-  Math, fptimer;
-
-type
-  TBGRAPBarStyle = (pbstNormal, pbstMultiProgress, pbstMarquee);
-  TBGRAPBarMarqueeMode = (pbmmToLeft, pbmmToRight);
-  TBGRAPBarMarqueeSpeed = (pbmsSlow, pbmsMedium, pbmsFast);
-
-  TBGRAProgressBarRedrawEvent = procedure(Sender: TObject; Bitmap: TBGRABitmap; xpos: integer) of object;
-
-  { TBGRADrawerFlashProgressBar }
-
-  TBGRADrawerFlashProgressBar = class(TPersistent)
-  private
-    FBackgroundColor: TColor;
-    FBackgroundRandomize: boolean;
-    FBackgroundRandomizeMaxIntensity: word;
-    FBackgroundRandomizeMinIntensity: word;
-    FBarColor,
-    FBarColorM: TColor;
-    FMarqueeMode: TBGRAPBarMarqueeMode;
-    FMarqueeSpeed: TBGRAPBarMarqueeSpeed;
-    FMarqueeWidth: Word;
-    FMaxValue: integer;
-    FMinValue: integer;
-    FOnChange: TNotifyEvent;
-    FRandSeed: integer;
-    FStyle: TBGRAPBarStyle;
-    FValue,
-    FValueM: integer;
-    xpos: integer;
-    marqueeTimer: TFPTimer;
-    marqueeLeft,
-    marqueeRight: Integer;
-
-    procedure SetBackgroundRandomize(AValue: boolean);
-    procedure SetBackgroundRandomizeMaxIntensity(AValue: word);
-    procedure SetBackgroundRandomizeMinIntensity(AValue: word);
-    procedure SetBarColor(AValue: TColor);
-    procedure SetBackgroundColor(AValue: TColor);
-    procedure SetBarColorM(AValue: TColor);
-    procedure SetMarqueeMode(AValue: TBGRAPBarMarqueeMode);
-    procedure SetMarqueeSpeed(AValue: TBGRAPBarMarqueeSpeed);
-    procedure SetMarqueeWidth(AValue: Word);
-    procedure SetMaxValue(AValue: integer);
-    procedure SetMinValue(AValue: integer);
-    procedure SetRandSeed(AValue: integer);
-    procedure SetStyle(AValue: TBGRAPBarStyle);
-    procedure SetValue(AValue: integer);
-    procedure SetValueM(AValue: integer);
-
-  protected
-    marqueeCurMode: TBGRAPBarMarqueeMode;
-
-    procedure MarqueeOnTimer(Sender: TObject);
-
-  public
-    constructor Create;
-    destructor Destroy; override;
-
-    procedure Draw(ABitmap: TBGRABitmap);
-
-    property OnChange: TNotifyEvent read FOnChange write FOnChange;
-    property RandSeed: integer read FRandSeed write SetRandSeed;
-    property BarColor: TColor read FBarColor write SetBarColor;
-    property BarColorM: TColor read FBarColorM write SetBarColorM;
-    property BackgroundColor: TColor read FBackgroundColor write SetBackgroundColor;
-    property BackgroundRandomizeMinIntensity: word
-      read FBackgroundRandomizeMinIntensity write SetBackgroundRandomizeMinIntensity;
-    property BackgroundRandomizeMaxIntensity: word
-      read FBackgroundRandomizeMaxIntensity write SetBackgroundRandomizeMaxIntensity;
-    property BackgroundRandomize: boolean read FBackgroundRandomize
-      write SetBackgroundRandomize;
-    property XPosition: integer read xpos;
-    property Style: TBGRAPBarStyle read FStyle write SetStyle default pbstNormal;
-    property MarqueeWidth: Word read FMarqueeWidth write SetMarqueeWidth default 30;
-    property MarqueeSpeed: TBGRAPBarMarqueeSpeed read FMarqueeSpeed write SetMarqueeSpeed default pbmsMedium;
-    property MarqueeMode: TBGRAPBarMarqueeMode read FMarqueeMode write SetMarqueeMode default pbmmToRight;
-
-    property MinValue: integer read FMinValue write SetMinValue;
-    property MaxValue: integer read FMaxValue write SetMaxValue;
-    property Value: integer read FValue write SetValue;
-    property ValueM: integer read FValueM write SetValueM;
-  end;
-
-implementation
-
-{ TBGRADrawerFlashProgressBar }
-
-procedure TBGRADrawerFlashProgressBar.SetBarColor(AValue: TColor);
-begin
-  if FBarColor = AValue then
-    Exit;
-  FBarColor := AValue;
-  if Assigned(FOnChange) then
-    FOnChange(Self);
-end;
-
-procedure TBGRADrawerFlashProgressBar.SetBackgroundRandomize(AValue: boolean);
-begin
-  if FBackgroundRandomize = AValue then
-    Exit;
-  FBackgroundRandomize := AValue;
-  if Assigned(FOnChange) then
-    FOnChange(Self);
-end;
-
-procedure TBGRADrawerFlashProgressBar.SetBackgroundRandomizeMaxIntensity(AValue: word);
-begin
-  if FBackgroundRandomizeMaxIntensity = AValue then
-    Exit;
-  FBackgroundRandomizeMaxIntensity := AValue;
-  if Assigned(FOnChange) then
-    FOnChange(Self);
-end;
-
-procedure TBGRADrawerFlashProgressBar.SetBackgroundRandomizeMinIntensity(AValue: word);
-begin
-  if FBackgroundRandomizeMinIntensity = AValue then
-    Exit;
-  FBackgroundRandomizeMinIntensity := AValue;
-  if Assigned(FOnChange) then
-    FOnChange(Self);
-end;
-
-procedure TBGRADrawerFlashProgressBar.SetBackgroundColor(AValue: TColor);
-begin
-  if FBackgroundColor = AValue then
-    Exit;
-  FBackgroundColor := AValue;
-  if Assigned(FOnChange) then
-    FOnChange(Self);
-end;
-
-procedure TBGRADrawerFlashProgressBar.SetBarColorM(AValue: TColor);
-begin
-  if FBarColorM = AValue then
-    Exit;
-  FBarColorM := AValue;
-  if Assigned(FOnChange) then
-    FOnChange(Self);
-end;
-
-procedure TBGRADrawerFlashProgressBar.SetMarqueeMode(AValue: TBGRAPBarMarqueeMode);
-begin
-  if (FMarqueeMode <> AValue) then
-  begin
-    FMarqueeMode:= AValue;
-    marqueeCurMode:= AValue;
-    if Assigned(FOnChange) then FOnChange(Self);
-  end;
-end;
-
-procedure TBGRADrawerFlashProgressBar.SetMarqueeSpeed(AValue: TBGRAPBarMarqueeSpeed);
-begin
-  FMarqueeSpeed:=AValue;
-  case FMarqueeSpeed of
-  pbmsSlow: marqueeTimer.Interval:= 50;
-  pbmsMedium: marqueeTimer.Interval:= 20;
-  pbmsFast: marqueeTimer.Interval:= 10;
-  end;
-end;
-
-procedure TBGRADrawerFlashProgressBar.SetMarqueeWidth(AValue: Word);
-begin
-  if FMarqueeWidth=AValue then Exit;
-  FMarqueeWidth:=AValue;
-end;
-
-procedure TBGRADrawerFlashProgressBar.SetMaxValue(AValue: integer);
-begin
-  if FMaxValue = AValue then
-    exit;
-  FMaxValue := AValue;
-  if FValue > FMaxValue then
-    FValue := FMaxValue;
-  if FMinValue > FMaxValue then
-    FMinValue := FMaxValue;
-  if Assigned(FOnChange) then
-    FOnChange(Self);
-end;
-
-procedure TBGRADrawerFlashProgressBar.SetMinValue(AValue: integer);
-begin
-  if FMinValue = AValue then
-    exit;
-  FMinValue := AValue;
-  if FValue < FMinValue then
-    FValue := FMinValue;
-  if FMaxValue < FMinValue then
-    FMaxValue := FMinValue;
-  if Assigned(FOnChange) then
-    FOnChange(Self);
-end;
-
-procedure TBGRADrawerFlashProgressBar.SetRandSeed(AValue: integer);
-begin
-  if FRandSeed = AValue then
-    Exit;
-  FRandSeed := AValue;
-end;
-
-procedure TBGRADrawerFlashProgressBar.SetStyle(AValue: TBGRAPBarStyle);
-begin
-  if (FStyle <> AValue) then
-  begin
-    if (AValue = pbstMarquee)
-    then begin
-           //if not(csDesigning in ComponentState) then
-           marqueeLeft:= 0;
-           marqueeTimer.Enabled:= True;
-         end
-    else marqueeTimer.Enabled:= False;
-
-    FStyle:= AValue;
-    if Assigned(FOnChange) then FOnChange(Self);
-  end;
-end;
-
-procedure TBGRADrawerFlashProgressBar.SetValue(AValue: integer);
-begin
-  if FValue = AValue then
-    exit;
-  FValue := AValue;
-  if FValue < FMinValue then
-    FValue := FMinValue;
-  if FValue > FMaxValue then
-    FValue := FMaxValue;
-  if Assigned(FOnChange) then
-    FOnChange(Self);
-end;
-
-procedure TBGRADrawerFlashProgressBar.SetValueM(AValue: integer);
-begin
-  if FValueM = AValue then
-    exit;
-  FValueM := AValue;
-  if FValueM < FMinValue then
-    FValueM := FMinValue;
-  if FValueM > FValue then
-    FValueM := FValue;
-  if Assigned(FOnChange) then
-    FOnChange(Self);
-end;
-
-procedure TBGRADrawerFlashProgressBar.MarqueeOnTimer(Sender: TObject);
-begin
-  if (marqueeCurMode = pbmmToRight)
-  then inc(marqueeLeft, 2)
-  else dec(marqueeRight, 2);
-
-  if Assigned(FOnChange) then FOnChange(Self);
-end;
-
-constructor TBGRADrawerFlashProgressBar.Create;
-begin
-  inherited Create;
-
-  FStyle:= pbstNormal;
-  FMarqueeWidth:= 30;
-  FMarqueeSpeed:= pbmsMedium;
-  FMarqueeMode:= pbmmToRight;
-  marqueeCurMode:= pbmmToRight;
-  marqueeLeft:= 0;
-  marqueeRight:= 0;
-  marqueeTimer:= TFPTimer.Create(nil);
-  marqueeTimer.Enabled:= False;
-  marqueeTimer.Interval:= 20;
-  marqueeTimer.OnTimer:= @MarqueeOnTimer;
-end;
-
-destructor TBGRADrawerFlashProgressBar.Destroy;
-begin
-  marqueeTimer.Free;
-  inherited Destroy;
-end;
-
-procedure TBGRADrawerFlashProgressBar.Draw(ABitmap: TBGRABitmap);
-var
-  content: TRect;
-  y, tx, ty,
-  marqueeOver: integer;
-  bgColor: TBGRAPixel;
-
-  function ApplyLightness(c: TBGRAPixel; lightness: word): TBGRAPixel;
-  begin
-    Result := GammaCompression(SetLightness(GammaExpansion(c), lightness));
-  end;
-
-  procedure DrawBar(bounds: TRect; AColor: TColor);
-  var
-    lCol: TBGRAPixel;
-  begin
-    lCol := AColor;
-
-    DoubleGradientAlphaFill(ABitmap, bounds,
-      ApplyLightness(lCol, 37000), ApplyLightness(lCol, 29000),
-      ApplyLightness(lCol, 26000), ApplyLightness(lCol, 18000),
-      gdVertical, gdVertical, gdVertical, 0.53);
-
-    InflateRect(bounds, -1, -1);
-
-    DoubleGradientAlphaFill(ABitmap, bounds,
-      ApplyLightness(lCol, 28000), ApplyLightness(lCol, 22000),
-      ApplyLightness(lCol, 19000), ApplyLightness(lCol, 11000),
-      gdVertical, gdVertical, gdVertical, 0.53);
-  end;
-
-begin
-  ABitmap.FillTransparent;
-  tx := ABitmap.Width;
-  ty := ABitmap.Height;
-
-  ABitmap.Rectangle(0, 0, tx, ty, BGRA(255, 255, 255, 6), BackgroundColor, dmSet);
-  if (tx > 2) and (ty > 2) then
-    ABitmap.Rectangle(1, 1, tx - 1, ty - 1, BGRA(29, 29, 29), dmSet);
-
-  if (tx > 4) and (ty > 4) then
-  begin
-    content  := Rect(2, 2, tx - 2, ty - 2);
-    randseed := FRandSeed;
-    if BackgroundRandomize then
-    for y := content.Top to content.Bottom - 1 do
-    begin
-      bgColor := BackgroundColor;
-      bgColor.Intensity := RandomRange(BackgroundRandomizeMinIntensity, BackgroundRandomizeMaxIntensity);
-      ABitmap.HorizLine(content.Left, y, content.Right - 1, bgColor, dmSet);
-    end;
-    if tx >= 6 then
-      ABitmap.DrawVertLine(content.Right - 1, content.Top, content.Bottom - 1,
-        BGRA(0, 0, 0, 32));
-
-    Case FStyle of
-      pbstNormal: begin
-        if FMaxValue > FMinValue then
-        begin
-          xpos := round((FValue - FMinValue) / (FMaxValue - FMinValue) *
-                        (content.right - content.left)) + content.left;
-          if xpos > content.left then
-          begin
-            DrawBar(rect(content.left, content.top, xpos, content.bottom), FBarColor);
-            if xpos < content.right then
-            begin
-              ABitmap.SetPixel(xpos, content.top, BGRA(62, 62, 62));
-              ABitmap.SetVertLine(xpos, content.top + 1, content.bottom - 1, BGRA(40, 40, 40));
-            end;
-          end;
-        end;
-      end;
-      pbstMultiProgress: begin
-        if FMaxValue > FMinValue then
-        begin
-          xpos := round((FValue - FMinValue) / (FMaxValue - FMinValue) *
-                        (content.right - content.left)) + content.left;
-          if xpos > content.left then
-          begin
-            DrawBar(rect(content.left, content.top, xpos, content.bottom), FBarColor);
-            if xpos < content.right then
-            begin
-              ABitmap.SetPixel(xpos, content.top, BGRA(62, 62, 62));
-              ABitmap.SetVertLine(xpos, content.top + 1, content.bottom - 1, BGRA(40, 40, 40));
-            end;
-          end;
-
-          xpos := round((FValueM - FMinValue) / (FMaxValue - FMinValue) *
-                        (content.right - content.left)) + content.left;
-          if xpos > content.left then
-          begin
-            DrawBar(rect(content.left, content.top, xpos, content.bottom), FBarColorM);
-            if xpos < content.right then
-            begin
-              ABitmap.SetPixel(xpos, content.top, BGRA(62, 62, 62));
-              ABitmap.SetVertLine(xpos, content.top + 1, content.bottom - 1, BGRA(40, 40, 40));
-            end;
-          end;
-
-        end;
-      end;
-      pbstMarquee: begin
-        if (marqueeCurMode = pbmmToRight)
-        then begin
-               if (marqueeLeft >= tx-2) then marqueeLeft:= 2;
-
-               marqueeRight:= marqueeLeft+(FMarqueeWidth-1);
-               marqueeOver:= 0;
-
-               if (marqueeRight > tx-2) then
-               begin
-                 marqueeOver:= marqueeRight-tx+4;
-                 marqueeRight:= tx-2;
-               end;
-
-               DrawBar(rect(marqueeLeft, content.top, marqueeRight, content.bottom), FBarColor);
-               ABitmap.SetPixel(marqueeLeft, content.top, BGRA(62, 62, 62));
-               ABitmap.SetVertLine(marqueeLeft, content.top + 1, content.bottom - 1, BGRA(40, 40, 40));
-
-               if (marqueeOver = 0)
-               then begin
-                      ABitmap.SetPixel(marqueeRight, content.top, BGRA(62, 62, 62));
-                      ABitmap.SetVertLine(marqueeRight, content.top + 1, content.bottom - 1, BGRA(40, 40, 40));
-                    end
-               else begin
-                      DrawBar(rect(2, content.top, marqueeOver, content.bottom), FBarColor);
-                      ABitmap.SetPixel(marqueeOver, content.top, BGRA(62, 62, 62));
-                      ABitmap.SetVertLine(marqueeOver, content.top + 1, content.bottom - 1, BGRA(40, 40, 40));
-                    end;
-             end
-        else begin
-               if (marqueeRight < 2) then marqueeRight:= tx-2;
-
-               marqueeLeft:= marqueeRight-(FMarqueeWidth-1);
-               marqueeOver:= 0;
-
-               if (marqueeRight < FMarqueeWidth) then
-               begin
-                 marqueeOver:= FMarqueeWidth-abs(marqueeLeft)+1;
-                 marqueeLeft:= tx-2-abs(marqueeLeft);
-               end;
-
-               if (marqueeOver = 0)
-               then begin
-                      DrawBar(rect(marqueeLeft, content.top, marqueeRight, content.bottom), FBarColor);
-                      ABitmap.SetPixel(marqueeLeft, content.top, BGRA(62, 62, 62));
-                      ABitmap.SetVertLine(marqueeLeft, content.top + 1, content.bottom - 1, BGRA(40, 40, 40));
-                      ABitmap.SetPixel(marqueeRight, content.top, BGRA(62, 62, 62));
-                      ABitmap.SetVertLine(marqueeRight, content.top + 1, content.bottom - 1, BGRA(40, 40, 40));
-                    end
-               else begin
-                      DrawBar(rect(2, content.top, marqueeOver, content.bottom), FBarColor);
-                      ABitmap.SetPixel(marqueeOver, content.top, BGRA(62, 62, 62));
-                      ABitmap.SetVertLine(marqueeOver, content.top + 1, content.bottom - 1, BGRA(40, 40, 40));
-                      DrawBar(rect(marqueeLeft, content.top, tx-2, content.bottom), FBarColor);
-                      ABitmap.SetPixel(marqueeLeft, content.top, BGRA(62, 62, 62));
-                      ABitmap.SetVertLine(marqueeLeft, content.top + 1, content.bottom - 1, BGRA(40, 40, 40));
-                    end;
-             end;
-      end;
-    end;
-  end;
-end;
-
-end.

+ 574 - 188
bgraflashprogressbar.pas

@@ -1,4 +1,3 @@
-// SPDX-License-Identifier: LGPL-3.0-linking-exception
 {
   Created by BGRA Controls Team
   Dibo, Circular, lainz (007) and contributors.
@@ -13,7 +12,12 @@
   (Compatibility with delphi VCL 11/2018)
 
 - Massimo Magnano
-    2024-12  Added Marquee and MultiProgress
+    2024-12  Added Marquee and MultiProgress Style
+             Added Caption, CaptionShowPercent, CaptionShowPercentAlign, CaptionShowPercentDigits;
+             Changed Values to Double Type;
+             Deleted Unit BGRADrawerFlashProgressBar;
+             New Test with all Features
+
 ***************************** END CONTRIBUTOR(S) *****************************}
 unit BGRAFlashProgressBar;
 
@@ -22,56 +26,90 @@ unit BGRAFlashProgressBar;
 interface
 
 uses
-  Classes, SysUtils, {$IFDEF FPC}LResources, LMessages,{$ENDIF} Forms, Controls, Graphics,
-  {$IFNDEF FPC}Messages, Windows, BGRAGraphics, GraphType, FPImage, {$ENDIF}
-  BCBaseCtrls, Dialogs, BGRABitmap, BGRADrawerFlashProgressBar;
+  Classes, {$IFDEF BGRABITMAP_USE_MSEGUI} mclasses, {$ENDIF}
+  SysUtils, Types, Forms, Controls, Graphics,
+  {$IFDEF FPC} LResources, LMessages,
+  {$ELSEIF} Messages, Windows, BGRAGraphics, GraphType, FPImage, {$ENDIF}
+  BCBaseCtrls, BGRABitmap, BGRABitmapTypes, BGRAGraphics, BGRAGradients,
+  Math, fptimer;
 
 type
+  TBGRAPBarStyle = (pbstNormal, pbstMultiProgress, pbstMarquee);
+  TBGRAPBarMarqueeDirection = (pbmdToRight, pbmdToLeft);
+  TBGRAPBarMarqueeSpeed = (pbmsSlow, pbmsMedium, pbmsFast);
+
+  TBGRAProgressBarRedrawEvent = procedure(Sender: TObject; Bitmap: TBGRABitmap; xpos: integer) of object;
+
   { TBGRAFlashProgressBar }
 
   TBGRAFlashProgressBar = class(TBGRAGraphicCtrl)
   private
     FBGRA: TBGRABitmap;
-    FDrawer: TBGRADrawerFlashProgressBar;
+    FCaptionPercentDigits: Integer;
+    FCaptionShowPercent: Boolean;
+    FCaptionShowPercentAlign: TAlignment;
+    FCaptionShowPercentAlignM: TAlignment;
+    FCaptionShowPercentM: Boolean;
+    FMarqueeBounce: Word;
     FOnRedraw: TBGRAProgressBarRedrawEvent;
-    function GetBackgroundColor: TColor;
-    function GetBackgroundRandomize: boolean;
-    function GetBackgroundRandomizeMaxIntensity: word;
-    function GetBackgroundRandomizeMinIntensity: word;
-    function GetBarColor: TColor;
-    function GetBarColorM: TColor;
-    function GetMarqueeMode: TBGRAPBarMarqueeMode;
-    function GetMarqueeSpeed: TBGRAPBarMarqueeSpeed;
-    function GetMarqueeWidth: Word;
-    function GetMaxValue: integer;
-    function GetMinValue: integer;
-    function GetStyle: TBGRAPBarStyle;
-    function GetValue: integer;
-    function GetValueM: integer;
-    procedure OnChangeDrawer(Sender: TObject);
-    procedure SetBackgroundColor(AValue: TColor);
+    FBackgroundColor: TColor;
+    FBackgroundRandomize: boolean;
+    FBackgroundRandomizeMaxIntensity: word;
+    FBackgroundRandomizeMinIntensity: word;
+    FBarColor,
+    FBarColorM: TColor;
+    FMarqueeDirection: TBGRAPBarMarqueeDirection;
+    FMarqueeSpeed: TBGRAPBarMarqueeSpeed;
+    FMarqueeWidth,
+    rMarqueeWidth: Word;
+    FMaxValue,
+    FMinValue,
+    FValue,
+    FValueM: Double;
+    FOnChange: TNotifyEvent;
+    FRandSeed: integer;
+    FStyle: TBGRAPBarStyle;
+    xpos: integer;
+    marqueeTimer: TFPTimer;
+    marqueeLeft,
+    marqueeRight: Integer;
+
     procedure SetBackgroundRandomize(AValue: boolean);
     procedure SetBackgroundRandomizeMaxIntensity(AValue: word);
     procedure SetBackgroundRandomizeMinIntensity(AValue: word);
     procedure SetBarColor(AValue: TColor);
+    procedure SetBackgroundColor(AValue: TColor);
     procedure SetBarColorM(AValue: TColor);
-    procedure SetMarqueeMode(AValue: TBGRAPBarMarqueeMode);
+    procedure SetCaptionPercentDigits(AValue: Integer);
+    procedure SetCaptionShowPercent(AValue: Boolean);
+    procedure SetCaptionShowPercentAlign(AValue: TAlignment);
+    procedure SetCaptionShowPercentAlignM(AValue: TAlignment);
+    procedure SetCaptionShowPercentM(AValue: Boolean);
+    procedure SetMarqueeBounce(AValue: Word);
+    procedure SetMarqueeDirection(AValue: TBGRAPBarMarqueeDirection);
     procedure SetMarqueeSpeed(AValue: TBGRAPBarMarqueeSpeed);
     procedure SetMarqueeWidth(AValue: Word);
-    procedure SetMaxValue(const AValue: integer);
-    procedure SetMinValue(const AValue: integer);
+    procedure SetMaxValue(AValue: Double);
+    procedure SetMinValue(AValue: Double);
+    procedure SetRandSeed(AValue: integer);
     procedure SetStyle(AValue: TBGRAPBarStyle);
-    procedure SetValue(const AValue: integer);
-    procedure SetValueM(AValue: integer);
+    procedure SetValue(AValue: Double);
+    procedure SetValueM(AValue: Double);
+
   protected
-    procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;
-      WithThemeSpace: boolean); override;
+    marqueeCurMode: TBGRAPBarMarqueeDirection;
+
+    procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer; WithThemeSpace: boolean); override;
+    procedure DoOnResize; override;
     procedure WMEraseBkgnd(var Message: {$IFDEF FPC}TLMEraseBkgnd{$ELSE}TWMEraseBkgnd{$ENDIF}); message {$IFDEF FPC}LM_ERASEBKGND{$ELSE}WM_ERASEBKGND{$ENDIF};
     procedure Paint; override;
+
+    procedure MarqueeOnTimer(Sender: TObject);
+
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
-  public
+
     { Streaming }
     {$IFDEF FPC}
     procedure SaveToFile(AFileName: string);
@@ -79,11 +117,42 @@ type
     procedure OnFindClass({%H-}Reader: TReader; const AClassName: string;
       var ComponentClass: TComponentClass);
     {$ENDIF}
+
+    procedure Draw(ABitmap: TBGRABitmap);
+
+    property XPosition: integer read xpos;
+
   published
     property Align;
     property Anchors;
+    property Caption;
+    property CaptionShowPercent: Boolean read FCaptionShowPercent write SetCaptionShowPercent default False;
+    property CaptionShowPercentAlign: TAlignment read FCaptionShowPercentAlign write SetCaptionShowPercentAlign default taCenter;
+    property CaptionShowPercentM: Boolean read FCaptionShowPercentM write SetCaptionShowPercentM default False;
+    property CaptionShowPercentAlignM: TAlignment read FCaptionShowPercentAlignM write SetCaptionShowPercentAlignM default taLeftJustify;
+    property CaptionPercentDigits: Integer read FCaptionPercentDigits write SetCaptionPercentDigits default 0;
     property Font;
     property ParentFont;
+    property MinValue: Double read FMinValue write SetMinValue;
+    property MaxValue: Double read FMaxValue write SetMaxValue;
+    property Value: Double read FValue write SetValue;
+    property ValueM: Double read FValueM write SetValueM;
+    property Color; deprecated 'User BarColor instead';
+    property RandSeed: integer read FRandSeed write SetRandSeed;
+    property BarColor: TColor read FBarColor write SetBarColor;
+    property BarColorM: TColor read FBarColorM write SetBarColorM;
+    property BackgroundColor: TColor read FBackgroundColor write SetBackgroundColor;
+    property BackgroundRandomizeMinIntensity: Word read FBackgroundRandomizeMinIntensity write SetBackgroundRandomizeMinIntensity;
+    property BackgroundRandomizeMaxIntensity: Word read FBackgroundRandomizeMaxIntensity write SetBackgroundRandomizeMaxIntensity;
+    property BackgroundRandomize: Boolean read FBackgroundRandomize write SetBackgroundRandomize;
+    property Style: TBGRAPBarStyle read FStyle write SetStyle default pbstNormal;
+    property MarqueeWidth: Word read FMarqueeWidth write SetMarqueeWidth default 0;
+    property MarqueeSpeed: TBGRAPBarMarqueeSpeed read FMarqueeSpeed write SetMarqueeSpeed default pbmsMedium;
+    property MarqueeDirection: TBGRAPBarMarqueeDirection read FMarqueeDirection write SetMarqueeDirection default pbmdToRight;
+
+    { #todo 5 -oMaxM : I'm implementing this in the new year }
+    property MarqueeBounce: Word read FMarqueeBounce write SetMarqueeBounce;
+
     property OnClick;
     property OnMouseDown;
     property OnMouseEnter;
@@ -93,30 +162,15 @@ type
     property OnMouseWheel;
     property OnMouseWheelUp;
     property OnMouseWheelDown;
-    property MinValue: integer Read GetMinValue Write SetMinValue;
-    property MaxValue: integer Read GetMaxValue Write SetMaxValue;
-    property Value: integer Read GetValue Write SetValue;
-    property ValueM: integer Read GetValueM Write SetValueM;
-    property Color; deprecated 'User BarColor instead';
-    property BarColor: TColor read GetBarColor write SetBarColor;
-    property BarColorM: TColor read GetBarColorM write SetBarColorM;
-    property BackgroundColor: TColor read GetBackgroundColor write SetBackgroundColor;
-    property BackgroundRandomizeMinIntensity: word read GetBackgroundRandomizeMinIntensity write SetBackgroundRandomizeMinIntensity;
-    property BackgroundRandomizeMaxIntensity: word read GetBackgroundRandomizeMaxIntensity write SetBackgroundRandomizeMaxIntensity;
-    property BackgroundRandomize: boolean read GetBackgroundRandomize write SetBackgroundRandomize;
-    property Style: TBGRAPBarStyle read GetStyle write SetStyle default pbstNormal;
-    property MarqueeWidth: Word read GetMarqueeWidth write SetMarqueeWidth default 30;
-    property MarqueeSpeed: TBGRAPBarMarqueeSpeed read GetMarqueeSpeed write SetMarqueeSpeed default pbmsMedium;
-    property MarqueeMode: TBGRAPBarMarqueeMode read GetMarqueeMode write SetMarqueeMode default pbmmToRight;
-
-    property OnRedraw: TBGRAProgressBarRedrawEvent read FOnredraw write FOnRedraw;
+    property OnChange: TNotifyEvent read FOnChange write FOnChange;
+    property OnRedraw: TBGRAProgressBarRedrawEvent read FOnRedraw write FOnRedraw;
   end;
 
 {$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
-uses BGRABitmapTypes;
+uses BGRATextFX;
 
 {$IFDEF FPC}
 procedure Register;
@@ -125,246 +179,578 @@ begin
 end;
 {$ENDIF}
 
-procedure TBGRAFlashProgressBar.SetMinValue(const AValue: integer);
-begin
-  FDrawer.MinValue := AValue;
-end;
+{ TBGRAFlashProgressBar }
 
-procedure TBGRAFlashProgressBar.SetStyle(AValue: TBGRAPBarStyle);
+procedure TBGRAFlashProgressBar.SetBarColor(AValue: TColor);
 begin
-  FDrawer.Style:= AValue;
-end;
+  if FBarColor = AValue then exit;
+  FBarColor := AValue;
 
-procedure TBGRAFlashProgressBar.SetValue(const AValue: integer);
-begin
-  FDrawer.Value := AValue;
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
 end;
 
-procedure TBGRAFlashProgressBar.SetValueM(AValue: integer);
+procedure TBGRAFlashProgressBar.SetBackgroundRandomize(AValue: boolean);
 begin
-  FDrawer.ValueM := AValue;
-end;
+  if FBackgroundRandomize = AValue then exit;
+  FBackgroundRandomize := AValue;
 
-{$hints off}
-procedure TBGRAFlashProgressBar.CalculatePreferredSize(
-  var PreferredWidth, PreferredHeight: integer; WithThemeSpace: boolean);
-begin
-  PreferredWidth  := 379;
-  PreferredHeight := 33;
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
 end;
 
-{$hints on}
-
-procedure TBGRAFlashProgressBar.Paint;
+procedure TBGRAFlashProgressBar.SetBackgroundRandomizeMaxIntensity(AValue: word);
 begin
-  if (ClientWidth <> FBGRA.Width) or (ClientHeight <> FBGRA.Height) then
-    FBGRA.SetSize(ClientWidth, ClientHeight);
-  FDrawer.Draw(FBGRA);
-  if Assigned(OnRedraw) then
-    OnRedraw(Self, FBGRA, {%H-}FDrawer.XPosition);
-  FBGRA.Draw(Canvas, 0, 0, False);
-end;
+  if FBackgroundRandomizeMaxIntensity = AValue then exit;
+  FBackgroundRandomizeMaxIntensity := AValue;
 
-{$hints off}
-procedure TBGRAFlashProgressBar.WMEraseBkgnd(var Message: {$IFDEF FPC}TLMEraseBkgnd{$ELSE}TWMEraseBkgnd{$ENDIF});
-begin
-  //do nothing
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
 end;
-{$hints on}
 
-constructor TBGRAFlashProgressBar.Create(AOwner: TComponent);
+procedure TBGRAFlashProgressBar.SetBackgroundRandomizeMinIntensity(AValue: word);
 begin
-  inherited Create(AOwner);
-
-  with GetControlClassDefaultSize do
-    SetInitialBounds(0, 0, CX, 33);
+  if FBackgroundRandomizeMinIntensity = AValue then exit;
+  FBackgroundRandomizeMinIntensity := AValue;
 
-  // Bitmap and Drawer
-  FBGRA := TBGRABitmap.Create(Width, Height);
-  FDrawer := TBGRADrawerFlashProgressBar.Create;
-  FDrawer.OnChange := OnChangeDrawer;
-  // Functionality
-  MinValue := 0;
-  MaxValue := 100;
-  Value := 30;
-  ValueM := 10;
-  // Functionality and Style
-  Randomize;
-  FDrawer.RandSeed := RandSeed;
-  // Style
-  Style:=pbstNormal;
-  BarColor := BGRA(102, 163, 226);
-  BarColorM := BGRA(200, 200, 60);
-  BackgroundColor := BGRA(47,47,47);
-  BackgroundRandomize := True;
-  BackgroundRandomizeMinIntensity := 4000;
-  BackgroundRandomizeMaxIntensity := 5000;
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
 end;
 
-destructor TBGRAFlashProgressBar.Destroy;
-begin
-  FreeAndNil(FBGRA);
-  FDrawer.Free;
-  inherited Destroy;
-end;
-{$IFDEF FPC}
-procedure TBGRAFlashProgressBar.SaveToFile(AFileName: string);
-var
-  AStream: TMemoryStream;
+procedure TBGRAFlashProgressBar.SetBackgroundColor(AValue: TColor);
 begin
-  AStream := TMemoryStream.Create;
-  try
-    WriteComponentAsTextToStream(AStream, Self);
-    AStream.SaveToFile(AFileName);
-  finally
-    AStream.Free;
-  end;
+  if FBackgroundColor = AValue then exit;
+  FBackgroundColor := AValue;
+
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
 end;
 
-procedure TBGRAFlashProgressBar.LoadFromFile(AFileName: string);
-var
-  AStream: TMemoryStream;
+procedure TBGRAFlashProgressBar.SetBarColorM(AValue: TColor);
 begin
-  AStream := TMemoryStream.Create;
-  try
-    AStream.LoadFromFile(AFileName);
-    ReadComponentFromTextStream(AStream, TComponent(Self), OnFindClass);
-  finally
-    AStream.Free;
-  end;
+  if FBarColorM = AValue then exit;
+  FBarColorM := AValue;
+
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
 end;
 
-procedure TBGRAFlashProgressBar.OnFindClass(Reader: TReader;
-  const AClassName: string; var ComponentClass: TComponentClass);
+procedure TBGRAFlashProgressBar.SetCaptionPercentDigits(AValue: Integer);
 begin
-  if CompareText(AClassName, 'TBGRAFlashProgressBar') = 0 then
-    ComponentClass := TBGRAFlashProgressBar;
+  if FCaptionPercentDigits=AValue then Exit;
+  FCaptionPercentDigits:=AValue;
+
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
 end;
-{$ENDIF}
 
-procedure TBGRAFlashProgressBar.SetMaxValue(const AValue: integer);
+procedure TBGRAFlashProgressBar.SetCaptionShowPercent(AValue: Boolean);
 begin
-  FDrawer.MaxValue := AValue;
+  if FCaptionShowPercent=AValue then Exit;
+  FCaptionShowPercent:=AValue;
+
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
 end;
 
-procedure TBGRAFlashProgressBar.OnChangeDrawer(Sender: TObject);
+procedure TBGRAFlashProgressBar.SetCaptionShowPercentAlign(AValue: TAlignment);
 begin
+  if FCaptionShowPercentAlign=AValue then Exit;
+  FCaptionShowPercentAlign:=AValue;
+
+  if Assigned(FOnChange) then FOnChange(Self);
   Invalidate;
 end;
 
-function TBGRAFlashProgressBar.GetBackgroundColor: TColor;
+procedure TBGRAFlashProgressBar.SetCaptionShowPercentAlignM(AValue: TAlignment);
 begin
-  Result := FDrawer.BackgroundColor;
+  if FCaptionShowPercentAlignM=AValue then Exit;
+  FCaptionShowPercentAlignM:=AValue;
+
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
 end;
 
-function TBGRAFlashProgressBar.GetBackgroundRandomize: boolean;
+procedure TBGRAFlashProgressBar.SetCaptionShowPercentM(AValue: Boolean);
 begin
-  Result := FDrawer.BackgroundRandomize;
+  if FCaptionShowPercentM=AValue then Exit;
+  FCaptionShowPercentM:=AValue;
+
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
 end;
 
-function TBGRAFlashProgressBar.GetBackgroundRandomizeMaxIntensity: word;
+procedure TBGRAFlashProgressBar.SetMarqueeBounce(AValue: Word);
 begin
-  Result := FDrawer.BackgroundRandomizeMaxIntensity;
+  if FMarqueeBounce=AValue then Exit;
+  FMarqueeBounce:=AValue;
+
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
 end;
 
-function TBGRAFlashProgressBar.GetBackgroundRandomizeMinIntensity: word;
+procedure TBGRAFlashProgressBar.SetMarqueeDirection(AValue: TBGRAPBarMarqueeDirection);
 begin
-  Result := FDrawer.BackgroundRandomizeMinIntensity;
+  if (FMarqueeDirection <> AValue) then
+  begin
+    FMarqueeDirection:= AValue;
+    marqueeCurMode:= AValue;
+
+    if Assigned(FOnChange) then FOnChange(Self);
+    Invalidate;
+  end;
 end;
 
-function TBGRAFlashProgressBar.GetBarColor: TColor;
+procedure TBGRAFlashProgressBar.SetMarqueeSpeed(AValue: TBGRAPBarMarqueeSpeed);
 begin
-  Result := FDrawer.BarColor;
+  FMarqueeSpeed:=AValue;
+  case FMarqueeSpeed of
+  pbmsSlow: marqueeTimer.Interval:= 50;
+  pbmsMedium: marqueeTimer.Interval:= 20;
+  pbmsFast: marqueeTimer.Interval:= 10;
+  end;
 end;
 
-function TBGRAFlashProgressBar.GetBarColorM: TColor;
+procedure TBGRAFlashProgressBar.SetMarqueeWidth(AValue: Word);
 begin
-  Result := FDrawer.BarColorM;
+  if FMarqueeWidth=AValue then Exit;
+  FMarqueeWidth:= AValue;
+  if (FMarqueeWidth = 0)
+  then rMarqueeWidth:= Width div 4
+  else rMarqueeWidth:= FMarqueeWidth;
+
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
 end;
 
-function TBGRAFlashProgressBar.GetMarqueeMode: TBGRAPBarMarqueeMode;
+procedure TBGRAFlashProgressBar.SetMaxValue(AValue: Double);
 begin
-  Result := FDrawer.MarqueeMode;
+  if FMaxValue = AValue then exit;
+
+  FMaxValue := AValue;
+  if (FValue > FMaxValue) then FValue := FMaxValue;
+  if (FMinValue > FMaxValue) then FMinValue := FMaxValue;
+
+
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
 end;
 
-function TBGRAFlashProgressBar.GetMarqueeSpeed: TBGRAPBarMarqueeSpeed;
+procedure TBGRAFlashProgressBar.SetMinValue(AValue: Double);
 begin
-  Result := FDrawer.MarqueeSpeed;
+  if FMinValue = AValue then exit;
+
+  FMinValue := AValue;
+  if (FValue < FMinValue) then FValue := FMinValue;
+  if (FMaxValue < FMinValue) then FMaxValue := FMinValue;
+
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
 end;
 
-function TBGRAFlashProgressBar.GetMarqueeWidth: Word;
+procedure TBGRAFlashProgressBar.SetRandSeed(AValue: integer);
 begin
-  Result := FDrawer.MarqueeWidth;
+  if FRandSeed = AValue then exit;
+  FRandSeed := AValue;
+
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
 end;
 
-function TBGRAFlashProgressBar.GetMaxValue: integer;
+procedure TBGRAFlashProgressBar.SetStyle(AValue: TBGRAPBarStyle);
 begin
-  Result := FDrawer.MaxValue;
+  if (FStyle <> AValue) then
+  begin
+    if (AValue = pbstMarquee)
+    then begin
+           marqueeLeft:= 0;
+
+           if not(csDesigning in ComponentState) then marqueeTimer.Enabled:= True;
+         end
+    else marqueeTimer.Enabled:= False;
+
+    FStyle:= AValue;
+    if Assigned(FOnChange) then FOnChange(Self);
+    Invalidate;
+  end;
 end;
 
-function TBGRAFlashProgressBar.GetMinValue: integer;
+procedure TBGRAFlashProgressBar.SetValue(AValue: Double);
 begin
-  Result := FDrawer.MinValue;
+  if FValue = AValue then exit;
+
+  FValue := AValue;
+  if (FValue < FMinValue) then FValue := FMinValue;
+  if (FValue > FMaxValue) then FValue := FMaxValue;
+
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
 end;
 
-function TBGRAFlashProgressBar.GetStyle: TBGRAPBarStyle;
+procedure TBGRAFlashProgressBar.SetValueM(AValue: Double);
 begin
-   Result := FDrawer.Style;
+  if FValueM = AValue then exit;
+
+  FValueM := AValue;
+  if (FValueM < FMinValue) then FValueM := FMinValue;
+  if (FValueM > FValue) then FValueM := FValue;
+
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
 end;
 
-function TBGRAFlashProgressBar.GetValue: integer;
+procedure TBGRAFlashProgressBar.MarqueeOnTimer(Sender: TObject);
 begin
-  Result := FDrawer.Value;
+  if (marqueeCurMode = pbmdToRight)
+  then inc(marqueeLeft, 2)
+  else dec(marqueeLeft, 2);
+
+  Invalidate;
 end;
 
-function TBGRAFlashProgressBar.GetValueM: integer;
+{$hints off}
+procedure TBGRAFlashProgressBar.CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer; WithThemeSpace: boolean);
 begin
-  Result := FDrawer.ValueM;
+  PreferredWidth  := 380;
+  PreferredHeight := 33;
 end;
 
-procedure TBGRAFlashProgressBar.SetBackgroundColor(AValue: TColor);
+procedure TBGRAFlashProgressBar.DoOnResize;
 begin
-  FDrawer.BackgroundColor := AValue;
+  inherited DoOnResize;
+
+  if (FMarqueeWidth = 0)
+  then rMarqueeWidth:= Width div 4
+  else rMarqueeWidth:= FMarqueeWidth;
 end;
 
-procedure TBGRAFlashProgressBar.SetBackgroundRandomize(AValue: boolean);
+{$hints on}
+
+procedure TBGRAFlashProgressBar.Paint;
 begin
-  FDrawer.BackgroundRandomize := AValue;
+  if (ClientWidth <> FBGRA.Width) or (ClientHeight <> FBGRA.Height)
+  then FBGRA.SetSize(ClientWidth, ClientHeight);
+
+  Draw(FBGRA);
+
+  if Assigned(OnRedraw) then OnRedraw(Self, FBGRA, {%H-}XPosition);
+
+  FBGRA.Draw(Canvas, 0, 0, False);
 end;
 
-procedure TBGRAFlashProgressBar.SetBackgroundRandomizeMaxIntensity(AValue: word);
+{$hints off}
+procedure TBGRAFlashProgressBar.WMEraseBkgnd(var Message: {$IFDEF FPC}TLMEraseBkgnd{$ELSE}TWMEraseBkgnd{$ENDIF});
 begin
-  FDrawer.BackgroundRandomizeMaxIntensity := AValue;
+  //do nothing
 end;
+{$hints on}
 
-procedure TBGRAFlashProgressBar.SetBackgroundRandomizeMinIntensity(AValue: word);
+constructor TBGRAFlashProgressBar.Create(AOwner: TComponent);
 begin
-  FDrawer.BackgroundRandomizeMinIntensity := AValue;
+  inherited Create(AOwner);
+
+  with GetControlClassDefaultSize do
+    SetInitialBounds(0, 0, CX, 33);
+
+  // Bitmap
+  FBGRA := TBGRABitmap.Create(Width, Height);
+  // Functionality
+  FMinValue := 0;
+  FMaxValue := 100;
+  FValue := 30;
+  FValueM := 10;
+  // Functionality and Style
+  Randomize;
+  FRandSeed := RandSeed;
+  FCaptionShowPercent:= False;
+  FCaptionShowPercentAlign:= taCenter;
+  FCaptionShowPercentAlignM:= taLeftJustify;
+  FCaptionPercentDigits:= 0;
+  Caption:= '';
+  // Style
+  FStyle:=pbstNormal;
+  FBarColor := BGRA(102, 163, 226);
+  FBarColorM := BGRA(240, 240, 15);
+  FBackgroundColor := BGRA(47,47,47);
+  FBackgroundRandomize := True;
+  FBackgroundRandomizeMinIntensity := 4000;
+  FBackgroundRandomizeMaxIntensity := 5000;
+  //Marquee
+  FMarqueeWidth:= 0; //AutoWidth
+  rMarqueeWidth:= 95; //PreferredWidth div 4
+  FMarqueeSpeed:= pbmsMedium;
+  FMarqueeDirection:= pbmdToRight;
+  marqueeCurMode:= pbmdToRight;
+  marqueeLeft:= 0;
+  marqueeRight:= 0;
+  marqueeTimer:= TFPTimer.Create(nil);
+  marqueeTimer.Enabled:= False;
+  marqueeTimer.Interval:= 20;
+  marqueeTimer.OnTimer:= MarqueeOnTimer;
 end;
 
-procedure TBGRAFlashProgressBar.SetBarColor(AValue: TColor);
+destructor TBGRAFlashProgressBar.Destroy;
 begin
-  FDrawer.BarColor := AValue;
+  marqueeTimer.Free;
+  FBGRA.Free;
+
+  inherited Destroy;
 end;
 
-procedure TBGRAFlashProgressBar.SetBarColorM(AValue: TColor);
+{$IFDEF FPC}
+procedure TBGRAFlashProgressBar.SaveToFile(AFileName: string);
+var
+  AStream: TMemoryStream;
 begin
-  FDrawer.BarColorM := AValue;
+  AStream := TMemoryStream.Create;
+  try
+    WriteComponentAsTextToStream(AStream, Self);
+    AStream.SaveToFile(AFileName);
+  finally
+    AStream.Free;
+  end;
 end;
 
-procedure TBGRAFlashProgressBar.SetMarqueeMode(AValue: TBGRAPBarMarqueeMode);
+procedure TBGRAFlashProgressBar.LoadFromFile(AFileName: string);
+var
+  AStream: TMemoryStream;
 begin
-  FDrawer.MarqueeMode:= AValue;
+  AStream := TMemoryStream.Create;
+  try
+    AStream.LoadFromFile(AFileName);
+    ReadComponentFromTextStream(AStream, TComponent(Self), OnFindClass);
+  finally
+    AStream.Free;
+  end;
 end;
 
-procedure TBGRAFlashProgressBar.SetMarqueeSpeed(AValue: TBGRAPBarMarqueeSpeed);
+procedure TBGRAFlashProgressBar.OnFindClass(Reader: TReader;
+  const AClassName: string; var ComponentClass: TComponentClass);
 begin
-  FDrawer.MarqueeSpeed:= AValue;
+  if CompareText(AClassName, 'TBGRAFlashProgressBar') = 0 then
+    ComponentClass := TBGRAFlashProgressBar;
 end;
+{$ENDIF}
+
+procedure TBGRAFlashProgressBar.Draw(ABitmap: TBGRABitmap);
+var
+  content: TRect;
+  y, tx, ty,
+  marqueeOver: integer;
+  bgColor: TBGRAPixel;
+  pStr: String;
+  pValue: Double;
+
+  function ApplyLightness(c: TBGRAPixel; lightness: word): TBGRAPixel;
+  begin
+    Result := GammaCompression(SetLightness(GammaExpansion(c), lightness));
+  end;
+
+  procedure DrawBar(bounds: TRect; AColor: TColor);
+  var
+    lCol: TBGRAPixel;
+  begin
+    lCol := AColor;
+
+    DoubleGradientAlphaFill(ABitmap, bounds,
+      ApplyLightness(lCol, 37000), ApplyLightness(lCol, 29000),
+      ApplyLightness(lCol, 26000), ApplyLightness(lCol, 18000),
+      gdVertical, gdVertical, gdVertical, 0.53);
+
+    InflateRect(bounds, -1, -1);
+
+    DoubleGradientAlphaFill(ABitmap, bounds,
+      ApplyLightness(lCol, 28000), ApplyLightness(lCol, 22000),
+      ApplyLightness(lCol, 19000), ApplyLightness(lCol, 11000),
+      gdVertical, gdVertical, gdVertical, 0.53);
+  end;
+
+  procedure DrawText(ACaption: String; AAlign: TAlignment);
+  var
+     fx: TBGRATextEffect;
+
+  begin
+    try
+       if (Font.Size=0)
+       then fx:= TBGRATextEffect.Create(ACaption, Font.Name, ABitmap.Height div 2, True)
+       else fx:= TBGRATextEffect.Create(ACaption, Font, True);
+
+       Case AAlign of
+         taLeftJustify: begin
+           fx.DrawOutline(ABitmap, 4, ABitmap.Height div 5, BGRABlack, taLeftJustify);
+           fx.Draw(ABitmap, 4, ABitmap.Height div 5, BGRAWhite, taLeftJustify);
+         end;
+         taRightJustify: begin
+           fx.DrawOutline(ABitmap, tx-4, ABitmap.Height div 5, BGRABlack, taRightJustify);
+           fx.Draw(ABitmap, tx-4, ABitmap.Height div 5, BGRAWhite, taRightJustify);
+         end;
+         taCenter: begin
+           fx.DrawOutline(ABitmap, ABitmap.Width div 2, ABitmap.Height div 5, BGRABlack, taCenter);
+           fx.Draw(ABitmap, ABitmap.Width div 2, ABitmap.Height div 5, BGRAWhite, taCenter);
+         end;
+       end;
+
+    finally
+      fx.Free;
+    end;
+  end;
 
-procedure TBGRAFlashProgressBar.SetMarqueeWidth(AValue: Word);
 begin
-  FDrawer.MarqueeWidth:= AValue;
+  ABitmap.FillTransparent;
+  tx := ABitmap.Width;
+  ty := ABitmap.Height;
+
+  ABitmap.Rectangle(0, 0, tx, ty, BGRA(255, 255, 255, 6), BackgroundColor, dmSet);
+  if (tx > 2) and (ty > 2) then
+    ABitmap.Rectangle(1, 1, tx - 1, ty - 1, BGRA(29, 29, 29), dmSet);
+
+  if (tx > 4) and (ty > 4) then
+  begin
+    content  := Rect(2, 2, tx - 2, ty - 2);
+    randseed := FRandSeed;
+    if BackgroundRandomize then
+    for y := content.Top to content.Bottom - 1 do
+    begin
+      bgColor := BackgroundColor;
+      bgColor.Intensity := RandomRange(BackgroundRandomizeMinIntensity, BackgroundRandomizeMaxIntensity);
+      ABitmap.HorizLine(content.Left, y, content.Right - 1, bgColor, dmSet);
+    end;
+    if tx >= 6 then
+      ABitmap.DrawVertLine(content.Right - 1, content.Top, content.Bottom - 1,
+        BGRA(0, 0, 0, 32));
+
+    Case FStyle of
+      pbstNormal: begin
+        if FMaxValue > FMinValue then
+        begin
+          xpos := round((FValue - FMinValue) / (FMaxValue - FMinValue) *
+                        (content.right - content.left)) + content.left;
+          if xpos > content.left then
+          begin
+            DrawBar(rect(content.left, content.top, xpos, content.bottom), FBarColor);
+            if xpos < content.right then
+            begin
+              ABitmap.SetPixel(xpos, content.top, BGRA(62, 62, 62));
+              ABitmap.SetVertLine(xpos, content.top + 1, content.bottom - 1, BGRA(40, 40, 40));
+            end;
+
+            //Draw Value Text
+            pStr:= '';
+            if FCaptionShowPercent then
+            begin
+              pValue:= 100*(FValue - FMinValue)/FMaxValue;
+              if (pValue <> 0) then pStr:= FloatToStrF(pValue, ffFixed, 15, FCaptionPercentDigits)+'%'
+            end;
+            DrawText(Caption+pStr, FCaptionShowPercentAlign);
+          end;
+        end;
+      end;
+      pbstMultiProgress: begin
+        if FMaxValue > FMinValue then
+        begin
+          xpos := round((FValue - FMinValue) / (FMaxValue - FMinValue) *
+                        (content.right - content.left)) + content.left;
+          if xpos > content.left then
+          begin
+            DrawBar(rect(content.left, content.top, xpos, content.bottom), FBarColor);
+            if xpos < content.right then
+            begin
+              ABitmap.SetPixel(xpos, content.top, BGRA(62, 62, 62));
+              ABitmap.SetVertLine(xpos, content.top + 1, content.bottom - 1, BGRA(40, 40, 40));
+            end;
+          end;
+
+          xpos := round((FValueM - FMinValue) / (FMaxValue - FMinValue) *
+                        (content.right - content.left)) + content.left;
+          if xpos > content.left then
+          begin
+            DrawBar(rect(content.left, content.top, xpos, content.bottom), FBarColorM);
+            if xpos < content.right then
+            begin
+              ABitmap.SetPixel(xpos, content.top, BGRA(62, 62, 62));
+              ABitmap.SetVertLine(xpos, content.top + 1, content.bottom - 1, BGRA(40, 40, 40));
+            end;
+          end;
+
+          //Draw Value Text
+          pStr:= '';
+          if FCaptionShowPercent then
+          begin
+            pValue:= 100*(FValue - FMinValue)/FMaxValue;
+            if (pValue <> 0) then pStr:= FloatToStrF(pValue, ffFixed, 15, FCaptionPercentDigits)+'%'
+          end;
+          DrawText(Caption+pStr, FCaptionShowPercentAlign);
+
+          //Draw ValueM Text
+          pStr:= '';
+          if FCaptionShowPercentM then
+          begin
+            pValue:= 100*(FValueM - FMinValue)/FMaxValue;
+            if (pValue <> 0) then pStr:= FloatToStrF(pValue, ffFixed, 15, FCaptionPercentDigits)+'%'
+          end;
+          DrawText(pStr, FCaptionShowPercentAlignM);
+        end;
+      end;
+      pbstMarquee: begin
+        if (marqueeCurMode = pbmdToRight)
+        then begin
+               //check if the whole bar is out put it back to the beginning
+               if (marqueeLeft >= tx-2) then
+               begin
+                 marqueeLeft:= 2;
+               end;
+
+               //Calculate the Right
+               marqueeRight:= marqueeLeft+(rMarqueeWidth-1);
+
+               //Check if part of the bar is out calculate the visible piece on the left
+               marqueeOver:= 0;
+               if (marqueeRight > tx-2) then
+               begin
+                 marqueeOver:= marqueeRight-(tx-2);
+               end;
+             end
+        else begin
+               //check if the whole bar is out put it back to the end
+               if (marqueeLeft <= -(rMarqueeWidth+2)) then
+               begin
+                 marqueeLeft:= tx-2-rMarqueeWidth;
+               end;
+
+               //Calculate the Right
+               marqueeRight:= marqueeLeft+(rMarqueeWidth-1);
+
+               //check if part of the bar is out then the visible piece on the left is equal to marqueeRight
+               marqueeOver:= 0;
+               if (marqueeRight < rMarqueeWidth) then
+               begin
+                 marqueeOver:= marqueeRight;
+               end;
+             end;
+
+        if (marqueeOver = 0)
+        then begin
+               //Draw Normal Bar Left-Right
+               DrawBar(rect(marqueeLeft, content.top, marqueeRight, content.bottom), FBarColor);
+               ABitmap.SetPixel(marqueeLeft, content.top, BGRA(62, 62, 62));
+               ABitmap.SetVertLine(marqueeLeft, content.top + 1, content.bottom - 1, BGRA(40, 40, 40));
+               ABitmap.SetPixel(marqueeRight, content.top, BGRA(62, 62, 62));
+               ABitmap.SetVertLine(marqueeRight, content.top + 1, content.bottom - 1, BGRA(40, 40, 40));
+             end
+        else begin
+               //Draw visible piece on the Left
+               DrawBar(rect(2, content.top, marqueeOver, content.bottom), FBarColor);
+               ABitmap.SetPixel(marqueeOver, content.top, BGRA(62, 62, 62));
+               ABitmap.SetVertLine(marqueeOver, content.top + 1, content.bottom - 1, BGRA(40, 40, 40));
+               //Draw visible piece on the Right
+               DrawBar(rect(tx-2-(rMarqueeWidth+1-marqueeOver), content.top, tx-2, content.bottom), FBarColor);
+               ABitmap.SetPixel(tx-2-(rMarqueeWidth+1-marqueeOver), content.top, BGRA(62, 62, 62));
+               ABitmap.SetVertLine(tx-2-(rMarqueeWidth+1-marqueeOver), content.top + 1, content.bottom - 1, BGRA(40, 40, 40));
+             end;
+
+      end;
+    end;
+  end;
 end;
 
 end.

+ 234 - 291
test/test_progressbar/umain.lfm

@@ -1,155 +1,42 @@
 object Form1: TForm1
   Left = 357
-  Height = 288
+  Height = 374
   Top = 179
-  Width = 340
+  Width = 387
   Caption = 'Form1'
-  ClientHeight = 288
-  ClientWidth = 340
-  object BGRAFlashProgressBar1: TBGRAFlashProgressBar
-    Left = 8
-    Height = 33
-    Top = 8
-    Width = 307
-    MinValue = 0
-    MaxValue = 100
-    Value = 50
-    Color = 14852966
-    BarColor = 14852966
-    BackgroundColor = 3092271
-    BackgroundRandomizeMinIntensity = 4000
-    BackgroundRandomizeMaxIntensity = 5000
-    BackgroundRandomize = True
-    OnRedraw = BGRAFlashProgressBar1Redraw
-  end
-  object BGRAFlashProgressBar2: TBGRAFlashProgressBar
-    Left = 8
-    Height = 33
-    Top = 48
-    Width = 307
-    OnClick = BGRAFlashProgressBar2Click
-    MinValue = 0
-    MaxValue = 100
-    Value = 50
-    Color = 14852966
-    BarColor = 14852966
-    BackgroundColor = 3092271
-    BackgroundRandomizeMinIntensity = 4000
-    BackgroundRandomizeMaxIntensity = 5000
-    BackgroundRandomize = True
-    OnRedraw = BGRAFlashProgressBar2Redraw
-  end
-  object BCTrackbarUpdown1: TBCTrackbarUpdown
-    Left = 8
-    Height = 26
-    Top = 96
-    Width = 328
-    AllowNegativeValues = False
-    BarExponent = 1
-    Increment = 1
-    LongTimeInterval = 400
-    MinValue = 0
-    MaxValue = 100
-    OnChange = BCTrackbarUpdown1Change
-    Value = 50
-    ShortTimeInterval = 100
-    Background.Color = clWindow
-    Background.Gradient1.StartColor = clWhite
-    Background.Gradient1.EndColor = clBlack
-    Background.Gradient1.GradientType = gtLinear
-    Background.Gradient1.Point1XPercent = 0
-    Background.Gradient1.Point1YPercent = 0
-    Background.Gradient1.Point2XPercent = 0
-    Background.Gradient1.Point2YPercent = 100
-    Background.Gradient2.StartColor = clWhite
-    Background.Gradient2.EndColor = clBlack
-    Background.Gradient2.GradientType = gtLinear
-    Background.Gradient2.Point1XPercent = 0
-    Background.Gradient2.Point1YPercent = 0
-    Background.Gradient2.Point2XPercent = 0
-    Background.Gradient2.Point2YPercent = 100
-    Background.Gradient1EndPercent = 35
-    Background.Style = bbsColor
-    ButtonBackground.Gradient1.StartColor = clBtnShadow
-    ButtonBackground.Gradient1.EndColor = clBtnFace
-    ButtonBackground.Gradient1.GradientType = gtLinear
-    ButtonBackground.Gradient1.Point1XPercent = 0
-    ButtonBackground.Gradient1.Point1YPercent = -50
-    ButtonBackground.Gradient1.Point2XPercent = 0
-    ButtonBackground.Gradient1.Point2YPercent = 50
-    ButtonBackground.Gradient2.StartColor = clBtnFace
-    ButtonBackground.Gradient2.EndColor = clBtnShadow
-    ButtonBackground.Gradient2.GradientType = gtLinear
-    ButtonBackground.Gradient2.Point1XPercent = 0
-    ButtonBackground.Gradient2.Point1YPercent = 50
-    ButtonBackground.Gradient2.Point2XPercent = 0
-    ButtonBackground.Gradient2.Point2YPercent = 150
-    ButtonBackground.Gradient1EndPercent = 50
-    ButtonBackground.Style = bbsGradient
-    ButtonDownBackground.Color = clBtnShadow
-    ButtonDownBackground.Gradient1.StartColor = clWhite
-    ButtonDownBackground.Gradient1.EndColor = clBlack
-    ButtonDownBackground.Gradient1.GradientType = gtLinear
-    ButtonDownBackground.Gradient1.Point1XPercent = 0
-    ButtonDownBackground.Gradient1.Point1YPercent = 0
-    ButtonDownBackground.Gradient1.Point2XPercent = 0
-    ButtonDownBackground.Gradient1.Point2YPercent = 100
-    ButtonDownBackground.Gradient2.StartColor = clWhite
-    ButtonDownBackground.Gradient2.EndColor = clBlack
-    ButtonDownBackground.Gradient2.GradientType = gtLinear
-    ButtonDownBackground.Gradient2.Point1XPercent = 0
-    ButtonDownBackground.Gradient2.Point1YPercent = 0
-    ButtonDownBackground.Gradient2.Point2XPercent = 0
-    ButtonDownBackground.Gradient2.Point2YPercent = 100
-    ButtonDownBackground.Gradient1EndPercent = 35
-    ButtonDownBackground.Style = bbsColor
-    Border.Color = clWindowText
-    Border.Style = bboSolid
-    Rounding.RoundX = 1
-    Rounding.RoundY = 1
-    Font.Color = clWindowText
-    Font.Name = 'Arial'
-    HasTrackBar = True
-    ArrowColor = clBtnText
-    TabOrder = 0
-    TabStop = True
-    UseDockManager = False
-  end
+  ClientHeight = 374
+  ClientWidth = 387
   object BGRASpeedButton1: TBGRASpeedButton
-    Left = 8
+    Left = 99
     Height = 22
-    Top = 192
+    Top = 160
     Width = 64
     Caption = 'Marquee'
     OnClick = BGRASpeedButton1Click
   end
   object BGRAMaxMProgress: TBGRAFlashProgressBar
-    Left = 8
+    Left = 4
     Height = 33
-    Top = 152
-    Width = 307
-    MinValue = 0
+    Top = 32
+    Width = 380
+    Font.Height = -16
+    ParentFont = False
     MaxValue = 100
     Value = 30
+    ValueM = 10
     Color = 14852966
+    RandSeed = 0
     BarColor = 14852966
+    BarColorM = 1044720
     BackgroundColor = 3092271
     BackgroundRandomizeMinIntensity = 4000
     BackgroundRandomizeMaxIntensity = 5000
     BackgroundRandomize = True
   end
-  object BGRASpeedButton2: TBGRASpeedButton
-    Left = 8
-    Height = 22
-    Top = 216
-    Width = 80
-    Caption = 'Right / Left'
-    OnClick = BGRASpeedButton2Click
-  end
   object rgMarqueeSpeed: TRadioGroup
-    Left = 88
+    Left = 115
     Height = 65
-    Top = 192
+    Top = 228
     Width = 79
     AutoFill = True
     Caption = 'Speed'
@@ -168,22 +55,22 @@ object Form1: TForm1
       'Medium'
       'Fast'
     )
-    TabOrder = 1
+    TabOrder = 0
     OnClick = rgMarqueeSpeedClick
   end
   object edMarqueeWidth: TBCTrackbarUpdown
-    Left = 13
+    Left = 130
     Height = 26
-    Top = 256
-    Width = 75
+    Top = 343
+    Width = 64
     AllowNegativeValues = False
     BarExponent = 1
     Increment = 1
     LongTimeInterval = 400
-    MinValue = 30
+    MinValue = 20
     MaxValue = 100
     OnChange = edMarqueeWidthChange
-    Value = 30
+    Value = 95
     ShortTimeInterval = 100
     Background.Color = clWindow
     Background.Gradient1.StartColor = clWhite
@@ -243,189 +130,245 @@ object Form1: TForm1
     Font.Name = 'Arial'
     HasTrackBar = True
     ArrowColor = clBtnText
-    TabOrder = 2
+    Enabled = False
+    TabOrder = 1
     TabStop = True
     UseDockManager = False
   end
   object Label1: TLabel
-    Left = 9
+    Left = 115
     Height = 15
-    Top = 241
+    Top = 304
     Width = 38
     Caption = 'Width :'
   end
   object BGRASpeedButton3: TBGRASpeedButton
-    Left = 193
+    Left = 239
     Height = 22
-    Top = 192
+    Top = 160
     Width = 79
     Caption = 'MultiProgress'
     OnClick = BGRASpeedButton3Click
   end
-  object edMultiPValue: TBCTrackbarUpdown
-    Left = 248
-    Height = 26
-    Top = 216
-    Width = 72
-    AllowNegativeValues = False
-    BarExponent = 1
-    Increment = 1
-    LongTimeInterval = 400
-    MinValue = 0
-    MaxValue = 100
-    OnChange = edMultiPValueChange
-    Value = 30
-    ShortTimeInterval = 100
-    Background.Color = clWindow
-    Background.Gradient1.StartColor = clWhite
-    Background.Gradient1.EndColor = clBlack
-    Background.Gradient1.GradientType = gtLinear
-    Background.Gradient1.Point1XPercent = 0
-    Background.Gradient1.Point1YPercent = 0
-    Background.Gradient1.Point2XPercent = 0
-    Background.Gradient1.Point2YPercent = 100
-    Background.Gradient2.StartColor = clWhite
-    Background.Gradient2.EndColor = clBlack
-    Background.Gradient2.GradientType = gtLinear
-    Background.Gradient2.Point1XPercent = 0
-    Background.Gradient2.Point1YPercent = 0
-    Background.Gradient2.Point2XPercent = 0
-    Background.Gradient2.Point2YPercent = 100
-    Background.Gradient1EndPercent = 35
-    Background.Style = bbsColor
-    ButtonBackground.Gradient1.StartColor = clBtnShadow
-    ButtonBackground.Gradient1.EndColor = clBtnFace
-    ButtonBackground.Gradient1.GradientType = gtLinear
-    ButtonBackground.Gradient1.Point1XPercent = 0
-    ButtonBackground.Gradient1.Point1YPercent = -50
-    ButtonBackground.Gradient1.Point2XPercent = 0
-    ButtonBackground.Gradient1.Point2YPercent = 50
-    ButtonBackground.Gradient2.StartColor = clBtnFace
-    ButtonBackground.Gradient2.EndColor = clBtnShadow
-    ButtonBackground.Gradient2.GradientType = gtLinear
-    ButtonBackground.Gradient2.Point1XPercent = 0
-    ButtonBackground.Gradient2.Point1YPercent = 50
-    ButtonBackground.Gradient2.Point2XPercent = 0
-    ButtonBackground.Gradient2.Point2YPercent = 150
-    ButtonBackground.Gradient1EndPercent = 50
-    ButtonBackground.Style = bbsGradient
-    ButtonDownBackground.Color = clBtnShadow
-    ButtonDownBackground.Gradient1.StartColor = clWhite
-    ButtonDownBackground.Gradient1.EndColor = clBlack
-    ButtonDownBackground.Gradient1.GradientType = gtLinear
-    ButtonDownBackground.Gradient1.Point1XPercent = 0
-    ButtonDownBackground.Gradient1.Point1YPercent = 0
-    ButtonDownBackground.Gradient1.Point2XPercent = 0
-    ButtonDownBackground.Gradient1.Point2YPercent = 100
-    ButtonDownBackground.Gradient2.StartColor = clWhite
-    ButtonDownBackground.Gradient2.EndColor = clBlack
-    ButtonDownBackground.Gradient2.GradientType = gtLinear
-    ButtonDownBackground.Gradient2.Point1XPercent = 0
-    ButtonDownBackground.Gradient2.Point1YPercent = 0
-    ButtonDownBackground.Gradient2.Point2XPercent = 0
-    ButtonDownBackground.Gradient2.Point2YPercent = 100
-    ButtonDownBackground.Gradient1EndPercent = 35
-    ButtonDownBackground.Style = bbsColor
-    Border.Color = clWindowText
-    Border.Style = bboSolid
-    Rounding.RoundX = 1
-    Rounding.RoundY = 1
-    Font.Color = clWindowText
-    Font.Name = 'Arial'
-    HasTrackBar = True
-    ArrowColor = clBtnText
-    TabOrder = 3
-    TabStop = True
-    UseDockManager = False
-  end
   object Label2: TLabel
-    Left = 199
+    Left = 260
     Height = 15
-    Top = 223
+    Top = 4
     Width = 34
     Caption = 'Value :'
   end
   object Label3: TLabel
-    Left = 199
+    Left = 255
     Height = 15
-    Top = 251
+    Top = 191
     Width = 48
     Caption = 'Value M :'
   end
-  object edMultiPValueM: TBCTrackbarUpdown
-    Left = 248
-    Height = 26
-    Top = 244
-    Width = 72
-    AllowNegativeValues = False
-    BarExponent = 1
-    Increment = 1
-    LongTimeInterval = 400
-    MinValue = 0
+  object cbMarqueeWidth: TCheckBox
+    Left = 130
+    Height = 19
+    Top = 320
+    Width = 44
+    Caption = 'Auto'
+    Checked = True
+    State = cbChecked
+    TabOrder = 2
+    OnChange = cbMarqueeWidthChange
+  end
+  object edCaption: TEdit
+    Left = 60
+    Height = 23
+    Top = 80
+    Width = 80
+    TabOrder = 3
+  end
+  object Label4: TLabel
+    Left = 8
+    Height = 15
+    Top = 84
+    Width = 48
+    Caption = 'Caption :'
+  end
+  object cbCaptionPercent: TCheckBox
+    Left = 148
+    Height = 19
+    Top = 80
+    Width = 90
+    Caption = 'Show Percent'
+    TabOrder = 4
+    OnChange = cbCaptionPercentChange
+  end
+  object Label6: TLabel
+    Left = 164
+    Height = 15
+    Top = 100
+    Width = 36
+    Caption = 'Digits :'
+  end
+  object edCaptionDigits: TSpinEdit
+    Left = 204
+    Height = 23
+    Top = 100
+    Width = 50
+    MaxValue = 30
+    TabOrder = 5
+    OnChange = edCaptionDigitsChange
+  end
+  object edValue: TFloatSpinEdit
+    Left = 296
+    Height = 23
+    Top = 0
+    Width = 80
+    Font.Color = clWindowText
+    Font.Name = 'Arial'
     MaxValue = 100
-    OnChange = edMultiPValueMChange
+    ParentFont = False
+    TabOrder = 6
+    Value = 30
+    OnChange = edValueChange
+  end
+  object edMultiPValueM: TFloatSpinEdit
+    Left = 304
+    Height = 23
+    Top = 186
+    Width = 80
+    Font.Color = clWindowText
+    Font.Name = 'Arial'
+    MaxValue = 100
+    ParentFont = False
+    TabOrder = 7
     Value = 10
-    ShortTimeInterval = 100
-    Background.Color = clWindow
-    Background.Gradient1.StartColor = clWhite
-    Background.Gradient1.EndColor = clBlack
-    Background.Gradient1.GradientType = gtLinear
-    Background.Gradient1.Point1XPercent = 0
-    Background.Gradient1.Point1YPercent = 0
-    Background.Gradient1.Point2XPercent = 0
-    Background.Gradient1.Point2YPercent = 100
-    Background.Gradient2.StartColor = clWhite
-    Background.Gradient2.EndColor = clBlack
-    Background.Gradient2.GradientType = gtLinear
-    Background.Gradient2.Point1XPercent = 0
-    Background.Gradient2.Point1YPercent = 0
-    Background.Gradient2.Point2XPercent = 0
-    Background.Gradient2.Point2YPercent = 100
-    Background.Gradient1EndPercent = 35
-    Background.Style = bbsColor
-    ButtonBackground.Gradient1.StartColor = clBtnShadow
-    ButtonBackground.Gradient1.EndColor = clBtnFace
-    ButtonBackground.Gradient1.GradientType = gtLinear
-    ButtonBackground.Gradient1.Point1XPercent = 0
-    ButtonBackground.Gradient1.Point1YPercent = -50
-    ButtonBackground.Gradient1.Point2XPercent = 0
-    ButtonBackground.Gradient1.Point2YPercent = 50
-    ButtonBackground.Gradient2.StartColor = clBtnFace
-    ButtonBackground.Gradient2.EndColor = clBtnShadow
-    ButtonBackground.Gradient2.GradientType = gtLinear
-    ButtonBackground.Gradient2.Point1XPercent = 0
-    ButtonBackground.Gradient2.Point1YPercent = 50
-    ButtonBackground.Gradient2.Point2XPercent = 0
-    ButtonBackground.Gradient2.Point2YPercent = 150
-    ButtonBackground.Gradient1EndPercent = 50
-    ButtonBackground.Style = bbsGradient
-    ButtonDownBackground.Color = clBtnShadow
-    ButtonDownBackground.Gradient1.StartColor = clWhite
-    ButtonDownBackground.Gradient1.EndColor = clBlack
-    ButtonDownBackground.Gradient1.GradientType = gtLinear
-    ButtonDownBackground.Gradient1.Point1XPercent = 0
-    ButtonDownBackground.Gradient1.Point1YPercent = 0
-    ButtonDownBackground.Gradient1.Point2XPercent = 0
-    ButtonDownBackground.Gradient1.Point2YPercent = 100
-    ButtonDownBackground.Gradient2.StartColor = clWhite
-    ButtonDownBackground.Gradient2.EndColor = clBlack
-    ButtonDownBackground.Gradient2.GradientType = gtLinear
-    ButtonDownBackground.Gradient2.Point1XPercent = 0
-    ButtonDownBackground.Gradient2.Point1YPercent = 0
-    ButtonDownBackground.Gradient2.Point2XPercent = 0
-    ButtonDownBackground.Gradient2.Point2YPercent = 100
-    ButtonDownBackground.Gradient1EndPercent = 35
-    ButtonDownBackground.Style = bbsColor
-    Border.Color = clWindowText
-    Border.Style = bboSolid
-    Rounding.RoundX = 1
-    Rounding.RoundY = 1
+    OnChange = edMultiPValueMChange
+  end
+  object Label5: TLabel
+    Left = 4
+    Height = 15
+    Top = 4
+    Width = 27
+    Caption = 'Min :'
+  end
+  object edMin: TFloatSpinEdit
+    Left = 35
+    Height = 23
+    Top = 0
+    Width = 80
     Font.Color = clWindowText
     Font.Name = 'Arial'
-    HasTrackBar = True
-    ArrowColor = clBtnText
-    TabOrder = 4
-    TabStop = True
-    UseDockManager = False
+    MaxValue = 100
+    ParentFont = False
+    TabOrder = 8
+    OnChange = edMinChange
+  end
+  object Label7: TLabel
+    Left = 128
+    Height = 15
+    Top = 4
+    Width = 29
+    Caption = 'Max :'
+  end
+  object edMax: TFloatSpinEdit
+    Left = 164
+    Height = 23
+    Top = 0
+    Width = 80
+    Font.Color = clWindowText
+    Font.Name = 'Arial'
+    MaxValue = 100
+    ParentFont = False
+    TabOrder = 9
+    Value = 100
+    OnChange = edMaxChange
+  end
+  object rgCaptionAlign: TRadioGroup
+    Left = 256
+    Height = 65
+    Top = 80
+    Width = 79
+    AutoFill = True
+    Caption = 'Align'
+    ChildSizing.LeftRightSpacing = 6
+    ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
+    ChildSizing.EnlargeVertical = crsHomogenousChildResize
+    ChildSizing.ShrinkHorizontal = crsScaleChilds
+    ChildSizing.ShrinkVertical = crsScaleChilds
+    ChildSizing.Layout = cclLeftToRightThenTopToBottom
+    ChildSizing.ControlsPerLine = 1
+    ClientHeight = 45
+    ClientWidth = 75
+    ItemIndex = 2
+    Items.Strings = (
+      'Left'
+      'Right'
+      'Center'
+    )
+    TabOrder = 10
+    OnClick = rgCaptionAlignClick
+  end
+  object cbCaptionPercentM: TCheckBox
+    Left = 255
+    Height = 19
+    Top = 216
+    Width = 90
+    Caption = 'Show Percent'
+    TabOrder = 11
+    OnChange = cbCaptionPercentMChange
+  end
+  object rgCaptionAlignM: TRadioGroup
+    Left = 271
+    Height = 65
+    Top = 238
+    Width = 79
+    AutoFill = True
+    Caption = 'Align'
+    ChildSizing.LeftRightSpacing = 6
+    ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
+    ChildSizing.EnlargeVertical = crsHomogenousChildResize
+    ChildSizing.ShrinkHorizontal = crsScaleChilds
+    ChildSizing.ShrinkVertical = crsScaleChilds
+    ChildSizing.Layout = cclLeftToRightThenTopToBottom
+    ChildSizing.ControlsPerLine = 1
+    ClientHeight = 45
+    ClientWidth = 75
+    ItemIndex = 0
+    Items.Strings = (
+      'Left'
+      'Right'
+      'Center'
+    )
+    TabOrder = 12
+    OnClick = rgCaptionAlignMClick
+  end
+  object rgMarqueeDirection: TRadioGroup
+    Left = 119
+    Height = 41
+    Top = 181
+    Width = 107
+    AutoFill = True
+    Caption = 'Direction'
+    ChildSizing.LeftRightSpacing = 6
+    ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
+    ChildSizing.EnlargeVertical = crsHomogenousChildResize
+    ChildSizing.ShrinkHorizontal = crsScaleChilds
+    ChildSizing.ShrinkVertical = crsScaleChilds
+    ChildSizing.Layout = cclLeftToRightThenTopToBottom
+    ChildSizing.ControlsPerLine = 2
+    ClientHeight = 21
+    ClientWidth = 103
+    Columns = 2
+    ItemIndex = 0
+    Items.Strings = (
+      'Right'
+      'Left'
+    )
+    TabOrder = 13
+    OnClick = rgMarqueeDirectionClick
+  end
+  object BGRASpeedButton4: TBGRASpeedButton
+    Left = 4
+    Height = 22
+    Top = 160
+    Width = 79
+    Caption = 'Normal'
+    OnClick = BGRASpeedButton4Click
   end
 end

+ 84 - 51
test/test_progressbar/umain.pas

@@ -5,41 +5,55 @@ unit umain;
 interface
 
 uses
-  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls, ExtCtrls, StdCtrls,
-  BGRAFlashProgressBar, BCTrackbarUpdown, BGRASpeedButton, BGRABitmap, BGRABitmapTypes,
-  BGRADrawerFlashProgressBar;
+  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls, ExtCtrls, StdCtrls, Spin,
+  BGRAFlashProgressBar, BCTrackbarUpdown, BGRASpeedButton, BGRABitmap, BGRABitmapTypes;
 
 type
 
   { TForm1 }
 
   TForm1 = class(TForm)
-    BCTrackbarUpdown1: TBCTrackbarUpdown;
     BGRASpeedButton3: TBGRASpeedButton;
+    BGRASpeedButton4: TBGRASpeedButton;
+    cbCaptionPercentM: TCheckBox;
+    cbMarqueeWidth: TCheckBox;
+    cbCaptionPercent: TCheckBox;
+    edCaption: TEdit;
     edMarqueeWidth: TBCTrackbarUpdown;
-    BGRAFlashProgressBar1: TBGRAFlashProgressBar;
-    BGRAFlashProgressBar2: TBGRAFlashProgressBar;
     BGRAMaxMProgress: TBGRAFlashProgressBar;
     BGRASpeedButton1: TBGRASpeedButton;
-    BGRASpeedButton2: TBGRASpeedButton;
-    edMultiPValue: TBCTrackbarUpdown;
-    edMultiPValueM: TBCTrackbarUpdown;
+    edMultiPValueM: TFloatSpinEdit;
+    edValue: TFloatSpinEdit;
+    edMin: TFloatSpinEdit;
+    edMax: TFloatSpinEdit;
     Label1: TLabel;
     Label2: TLabel;
     Label3: TLabel;
+    Label4: TLabel;
+    Label5: TLabel;
+    Label6: TLabel;
+    Label7: TLabel;
+    rgCaptionAlignM: TRadioGroup;
     rgMarqueeSpeed: TRadioGroup;
+    edCaptionDigits: TSpinEdit;
+    rgCaptionAlign: TRadioGroup;
+    rgMarqueeDirection: TRadioGroup;
     procedure BCTrackbarUpdown1Change(Sender: TObject; AByUser: boolean);
-    procedure BGRAFlashProgressBar1Redraw(Sender: TObject; Bitmap: TBGRABitmap;
-      xpos: integer);
-    procedure BGRAFlashProgressBar2Click(Sender: TObject);
-    procedure BGRAFlashProgressBar2Redraw(Sender: TObject; Bitmap: TBGRABitmap;
-      xpos: integer);
     procedure BGRASpeedButton1Click(Sender: TObject);
-    procedure BGRASpeedButton2Click(Sender: TObject);
     procedure BGRASpeedButton3Click(Sender: TObject);
+    procedure BGRASpeedButton4Click(Sender: TObject);
+    procedure cbCaptionPercentMChange(Sender: TObject);
+    procedure cbMarqueeWidthChange(Sender: TObject);
+    procedure cbCaptionPercentChange(Sender: TObject);
+    procedure edCaptionDigitsChange(Sender: TObject);
+    procedure edMaxChange(Sender: TObject);
+    procedure edMinChange(Sender: TObject);
     procedure edMultiPValueMChange(Sender: TObject; AByUser: boolean);
-    procedure edMultiPValueChange(Sender: TObject; AByUser: boolean);
+    procedure edValueChange(Sender: TObject; AByUser: boolean);
     procedure edMarqueeWidthChange(Sender: TObject; AByUser: boolean);
+    procedure rgCaptionAlignClick(Sender: TObject);
+    procedure rgCaptionAlignMClick(Sender: TObject);
+    procedure rgMarqueeDirectionClick(Sender: TObject);
     procedure rgMarqueeSpeedClick(Sender: TObject);
   private
     { private declarations }
@@ -58,75 +72,94 @@ uses BGRATextFX;
 
 { TForm1 }
 
-procedure TForm1.BGRAFlashProgressBar2Redraw(Sender: TObject;
-  Bitmap: TBGRABitmap; xpos: integer);
+procedure TForm1.BGRASpeedButton1Click(Sender: TObject);
 begin
-  { Draw the progressbar container }
-  Bitmap.Rectangle(0, 0, Bitmap.Width, Bitmap.Height, BGRABlack, BGRAWhite, dmSet);
-  { Draw the progressbar progress }
-  Bitmap.Rectangle(1, 1, xpos + 1, Bitmap.Height - 1, BGRAWhite, BGRABlack, dmSet);
+  BGRAMaxMProgress.Style:= pbstMarquee;
 end;
 
-procedure TForm1.BGRASpeedButton1Click(Sender: TObject);
+procedure TForm1.BGRASpeedButton3Click(Sender: TObject);
 begin
-  BGRAMaxMProgress.Style:= pbstMarquee;
+  BGRAMaxMProgress.Style:= pbstMultiProgress;
 end;
 
-procedure TForm1.BGRASpeedButton2Click(Sender: TObject);
+procedure TForm1.BGRASpeedButton4Click(Sender: TObject);
 begin
-  if (BGRAMaxMProgress.MarqueeMode = pbmmToRight)
-  then BGRAMaxMProgress.MarqueeMode:= pbmmToLeft
-  else BGRAMaxMProgress.MarqueeMode:= pbmmToRight;
+  BGRAMaxMProgress.Style:= pbstNormal;
 end;
 
-procedure TForm1.BGRASpeedButton3Click(Sender: TObject);
+procedure TForm1.cbCaptionPercentMChange(Sender: TObject);
 begin
-  BGRAMaxMProgress.Style:= pbstMultiProgress;
+  BGRAMaxMProgress.CaptionShowPercentM:= cbCaptionPercentM.Checked;
+end;
+
+procedure TForm1.cbMarqueeWidthChange(Sender: TObject);
+begin
+  if cbMarqueeWidth.checked
+  then BGRAMaxMProgress.MarqueeWidth:= 0
+  else BGRAMaxMProgress.MarqueeWidth:= edMarqueeWidth.Value;
+
+  edMarqueeWidth.Enabled:= not(cbMarqueeWidth.checked);
+end;
+
+procedure TForm1.cbCaptionPercentChange(Sender: TObject);
+begin
+  BGRAMaxMProgress.CaptionShowPercent:= cbCaptionPercent.Checked;
+end;
+
+procedure TForm1.edCaptionDigitsChange(Sender: TObject);
+begin
+  BGRAMaxMProgress.CaptionPercentDigits:= edCaptionDigits.Value;
+end;
+
+procedure TForm1.edMaxChange(Sender: TObject);
+begin
+  BGRAMaxMProgress.MaxValue:=edMax.Value;
+end;
+
+procedure TForm1.edMinChange(Sender: TObject);
+begin
+  BGRAMaxMProgress.MinValue:=edMin.Value;
 end;
 
 procedure TForm1.edMultiPValueMChange(Sender: TObject; AByUser: boolean);
 begin
-  if AByUser then
-  begin
-    BGRAMaxMProgress.ValueM:= edMultiPValueM.Value;
-    edMultiPValueM.Value:= BGRAMaxMProgress.ValueM;
-  end;
+  BGRAMaxMProgress.ValueM:= edMultiPValueM.Value;
+  edMultiPValueM.Value:= BGRAMaxMProgress.ValueM;
 end;
 
-procedure TForm1.edMultiPValueChange(Sender: TObject; AByUser: boolean);
+procedure TForm1.edValueChange(Sender: TObject; AByUser: boolean);
 begin
-  BGRAMaxMProgress.Value:= edMultiPValue.Value;
+  BGRAMaxMProgress.Value:= edValue.Value;
 end;
 
 procedure TForm1.edMarqueeWidthChange(Sender: TObject; AByUser: boolean);
 begin
-  BGRAMaxMProgress.MarqueeWidth:= edMarqueeWidth.Value;
+  if AByUser then BGRAMaxMProgress.MarqueeWidth:= edMarqueeWidth.Value;
 end;
 
-procedure TForm1.rgMarqueeSpeedClick(Sender: TObject);
+procedure TForm1.rgCaptionAlignClick(Sender: TObject);
 begin
-  BGRAMaxMProgress.MarqueeSpeed:= TBGRAPBarMarqueeSpeed(rgMarqueeSpeed.ItemIndex);
+  BGRAMaxMProgress.CaptionShowPercentAlign:= TAlignment(rgCaptionAlign.ItemIndex);
 end;
 
-procedure TForm1.BCTrackbarUpdown1Change(Sender: TObject; AByUser: boolean);
+procedure TForm1.rgCaptionAlignMClick(Sender: TObject);
 begin
-  BGRAFlashProgressBar1.Value := BCTrackbarUpdown1.Value;
-  BGRAFlashProgressBar2.Value := BCTrackbarUpdown1.Value;
+  BGRAMaxMProgress.CaptionShowPercentAlignM:= TAlignment(rgCaptionAlignM.ItemIndex);
 end;
 
-procedure TForm1.BGRAFlashProgressBar1Redraw(Sender: TObject;
-  Bitmap: TBGRABitmap; xpos: integer);
-var fx: TBGRATextEffect;
+procedure TForm1.rgMarqueeDirectionClick(Sender: TObject);
 begin
-  fx:= TBGRATextEffect.Create(IntToStr(BGRAFlashProgressBar1.Value)+'%','Arial',BGRAFlashProgressBar1.Height div 2,True);
-  fx.DrawOutline(Bitmap, Bitmap.Width div 2,Bitmap.Height div 4,BGRABlack,taCenter);
-  fx.Draw(Bitmap, Bitmap.Width div 2,Bitmap.Height div 4,BGRAWhite,taCenter);
-  fx.Free;
+  BGRAMaxMProgress.MarqueeDirection:= TBGRAPBarMarqueeDirection(rgMarqueeDirection.ItemIndex);
 end;
 
-procedure TForm1.BGRAFlashProgressBar2Click(Sender: TObject);
+procedure TForm1.rgMarqueeSpeedClick(Sender: TObject);
 begin
+  BGRAMaxMProgress.MarqueeSpeed:= TBGRAPBarMarqueeSpeed(rgMarqueeSpeed.ItemIndex);
+end;
 
+procedure TForm1.BCTrackbarUpdown1Change(Sender: TObject; AByUser: boolean);
+begin
+  BGRAMaxMProgress.Value := edValue.Value;
 end;
 
 end.