ExCtrls/ProgressBarEx: Add TextMode tmValueAndPercent

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8783 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-03-29 18:03:46 +00:00
parent 3b94b13c57
commit 6cd7bf9902
3 changed files with 89 additions and 64 deletions

View File

@ -55,6 +55,7 @@ type
procedure seMarqueeSpeedChange(Sender: TObject);
private
ProgressbarEx: TProgressbarEx;
BarHeight: Integer;
public
@ -74,13 +75,14 @@ begin
ProgressbarEx := TProgressbarEx.Create(self);
ProgressbarEx.Left := 8;
ProgressbarEx.Top := 8;
ProgressbarEx.Width := 450;
ProgressbarEx.Height := 32;
ProgressbarEx.Width := 500;
ProgressbarEx.Height := 28;
ProgressbarEx.Parent := self;
Progressbarex.Position := 75;
Progressbar1.Left := ProgressbarEx.Left;
Progressbar1.Width := ProgressbarEx.Width;
BarHeight := ProgressBar1.Height;
clbBackColor.ButtonColor := ProgressbarEx.BackColor;
clbBarColor.ButtonColor := ProgressbarEx.BarColor;
@ -88,9 +90,8 @@ begin
clbBorderColor.ButtonColor := ProgressbarEx.BorderColor;
Scrollbar1.Position := ProgressbarEx.Position;
Edit1.Hide;
Width := ProgressbarEx.Width + 2*ProgressbarEx.Left;
Width := ProgressbarEx.Width + 32;
Height := Width;
end;
@ -98,8 +99,9 @@ procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
ProgressBarEx.TextMode := TProgressbarTextMode(RadioGroup1.ItemIndex);
case ProgressBarEx.TextMode of
tmValue: ProgressBarEx.Caption := 'Voltage: %.0f mV';
tmPercent: ProgressBarEx.Caption := '%.1f%% complete';
tmValue: ProgressBarEx.Caption := 'Voltage: %d mV';
tmPercent: ProgressBarEx.Caption := '%.0f%% complete';
tmValueAndPercent: ProgressBarEx.Caption := '%1:.0f%% complete at position %0:d';
tmCustom: ProgressBarEx.Caption := Edit1.Text;
end;
end;
@ -116,16 +118,13 @@ begin
ProgressbarEx.Caption := IntToStr(ProgressbarEx.Position);
Scrollbar1.Position := ProgressbarEx.Position;
Scrollbar1.Show;
Edit1.Hide;
end;
procedure TForm1.rbMarqueeStyleChange(Sender: TObject);
begin
Progressbar1.Style := pbstMarquee;
ProgressbarEx.Style := pbstMarquee;
ProgressbarEx.Caption := Edit1.Text;
Scrollbar1.Hide;
Edit1.Show;
end;
procedure TForm1.rgDrawingStyleClick(Sender: TObject);
@ -140,15 +139,17 @@ begin
Progressbar1.Orientation := ProgressBarEx.Orientation;
if Progressbar1.Orientation in [pbVertical, pbTopDown] then
begin
Progressbar1.Left := 32;
Progressbar1.Left := 40;
Progressbar1.Top := 8;
Progressbar1.Width := BarHeight;
ProgressBar1.Height := ProgressBarEx.Height;
end else
begin
Progressbar1.Left := 8;
Progressbar1.Top := 32;
Progressbar1.Top := 40;
ProgressBar1.Height := BarHeight;
ProgressBar1.Width := ProgressBarEx.Width;
end;
Progressbar1.Width := ProgressbarEx.Width;
Progressbar1.Height := ProgressbarEx.Height;
end;
procedure TForm1.Edit1Change(Sender: TObject);