I am targeting to draw a custom animated progress bar in VST
My goal is drawing a similar result as image below, I tried to do something like this OnBeforeCellPaint
:
procedure TForm2.VTs1BeforeCellPaint(Sender: TBaseVirtualTree;
TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect);
var
NewRect : TRect;
xOff, yOff : Integer;
ProgressBarRect: TRect;
Percents: Real;
DrawProgressBar: Boolean;
begin
//draw progress
Percents := 10; // 40%
// progressBar on Column 3
begin
// draw progressbar
ProgressBarRect.Left := 0;
ProgressBarRect.Top := CellRect.Top + 1;
ProgressBarRect.Right := round((CellRect.Right - CellRect.Left) * Percents) + CellRect.Left;
ProgressBarRect.Bottom := CellRect.Bottom - 1;
if (ProgressBarRect.Right - ProgressBarRect.Left) > 0 then
begin
TargetCanvas.Brush.Color := RGB(179,255,102);
TargetCanvas.FillRect(ProgressBarRect);
end;
// ProgressBarRect
inc(ProgressBarRect.Left);
inc(ProgressBarRect.Top);
dec(ProgressBarRect.Right);
dec(ProgressBarRect.Bottom);
if (ProgressBarRect.Right - ProgressBarRect.Left) > 0 then
begin
TargetCanvas.Brush.Color := RGB(221,255,187);
TargetCanvas.FillRect(ProgressBarRect);
end;
end;
end;
but I can't do the same result and reach the same approach as the image which follows:
That's the result I've got in coding:
The progress bars are coming along to the node not beside it and its not same design as showing in the image it comes yellow long back ground of the node I wanted to make it in the left side of the node and have the same design of the animated image that I've posted above.