Hello forum members, I wanted to create a custom bar from the TPanel component. I wrote the beginning, but I was concerned with the calculation of the position of the bar.
procedure TForm1.Panel2MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var
NewX, Max: Integer;
begin
if not(ssLeft in Shift) then Exit;
NewX := X + Panel2.Left;
Max := Panel1.ClientWidth - Panel2.Width;
if NewX < 0 then NewX := 0;
if NewX > Max then NewX := Max;
Panel2.Left := NewX;
end;
0. zero point
1st belt position
2.100%
Can I ask for help in finalizing?