Razgris6146
Razgris6146

Reputation: 41

How to make TrackBar balance in Delphi?

here is my new problem

I have set TrackBar1, Max to 200,Frequency to 10,Position = 100, what i want is something like this, it move from -100..0..100.

Also, how to make the slider move to each needle bar? Thank you..

procedure TForm1.TrackBar1Change(Sender: TObject);
  begin
  Edit1.Text := IntToStr(Trackbar1.Position);
  end;

end.

Upvotes: 0

Views: 2444

Answers (2)

Try this code:

procedure TForm1.FormCreate(Sender: TObject);
begin
  TrackBar1.Min := -100;
  TrackBar1.Max := 100;
  TrackBar1.Frequency := 10;
  TrackBar1.TickStyle := tsAuto;
  Edit1.Text := IntToStr(TrackBar1.Position);
end;

procedure TForm1.TrackBar1Change(Sender: TObject);
begin
  Edit1.Text := IntToStr(TrackBar1.Position);
end;

Upvotes: 0

Victoria
Victoria

Reputation: 7912

To move the thumb by the steps of the Frequency value set the Frequency property to 10 and TickStyle to tsAuto in your case. To setup the range to the negative values simply do that by setting the Min property value to -100.

Upvotes: 1

Related Questions