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;
function getSoundLevelPercentage(iLevel: Integer): Double;
begin
Result := iLevel/100;
end;
... where iLevel goes from 0 to 100, and result goes from 0.0 to 1.0
Title | # Comments | Views | Activity |
---|---|---|---|
nestparen challenge | 4 | 55 | |
Open a URL with Internet Explorer in a new tab (not a new window) | 1 | 41 | |
LAN or WAN ? | 11 | 58 | |
why my code login on a web site with access vba don't work on microsoft access 2016 | 26 | 43 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
10 Experts available now in Live!