Recent

Author Topic: [SOLVED] Panel bar  (Read 255 times)

Pe3s

  • Sr. Member
  • ****
  • Posts: 330
[SOLVED] Panel bar
« on: November 14, 2022, 06:17:46 pm »
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.
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Panel2MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
  2. var
  3.   NewX, Max: Integer;
  4. begin
  5.   if not(ssLeft in Shift) then Exit;
  6.   NewX := X + Panel2.Left;
  7.   Max := Panel1.ClientWidth - Panel2.Width;
  8.   if NewX < 0 then NewX := 0;
  9.   if NewX > Max then NewX := Max;
  10.   Panel2.Left := NewX;
  11. end;
  12.  
0. zero point
1st belt position
2.100%
Can I ask for help in finalizing?

« Last Edit: November 14, 2022, 07:50:17 pm by Pe3s »

howardpc

  • Hero Member
  • *****
  • Posts: 4104
Re: Panel bar
« Reply #1 on: November 14, 2022, 07:37:46 pm »
Do you mean something like the attached adapted project?

Pe3s

  • Sr. Member
  • ****
  • Posts: 330
Re: Panel bar
« Reply #2 on: November 14, 2022, 07:49:56 pm »
That's exactly what I wanted to do. Thank you very much. Greetings with a smile :)

 

TinyPortal © 2005-2018