Percents := Percents + PercInt/100;
where you can put PercInt to 50 (percent). Do you have problem to generate random numbers?
procedure TForm2.VirtualStringTree1BeforeCellPaint(Sender: TBaseVirtualTree;
TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect);
procedure drawProgress(AWidth: Integer; APercent: Real; ASteps: Integer; ALeft: Integer = 1);
var
r: TRect;
h, n: Integer;
begin
if APercent > 1 then
APercent := 1
else if APercent = 0 then
Exit;//nothing to draw
h := Round(CellRect.Height / ASteps) - 1;
r.Top := CellRect.bottom - h - 1;
r.Left := ALeft;
r.Width := AWidth;
TargetCanvas.Brush.Color := clSkyBlue;
n := Ceil(APercent * ASteps);//how many rect to draw?
while n > 0 do begin
r.Height := h;
TargetCanvas.FillRect(r);
Dec(r.Top, 1 + h);
Dec(n);
end;
end;
begin
drawProgress(10, 1, 7);
drawProgress(30, Percents, 7, 1 + 10 + 1);
end;
Percents := Percents + 0.025;
so i cannot set it to redraw the animated bar from 0 to 100 any idea how to tweak this ?var
Percents: Real;
procedure TForm2.Timer1Timer(Sender: TObject);
begin
if Percents > 1 then
Percents := 0
else
Percents := Percents + 0.025;
VirtualStringTree1.Repaint;
end;
procedure TFORM1.SoundLevel(Sender: TObject; Level: Integer);
begin
// this Level Value have maximum value that equals to 100
//so i needed to make the percents equals to that value to allow the tree redraw the animated level bar with the same value of the sound level
end;
global var
Percents: Real;
//initiate percent
Percents := 0.2;
if Percents > 1 then
begin
Percents := 0.5;
end
else
begin
Percents := Percents + 0.025;
end;
vstmca.Invalidate;
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
base64 decode encode | 12 | 119 | |
Error E2158 compiling with Delphi XE10 Seattle | 2 | 83 | |
Is there a canned solution for a custom genealogy website | 2 | 79 | |
Windows and other UI names - The Proper names for the Various elements! | 1 | 55 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
9 Experts available now in Live!