ExCtrls/TProgressBarEx: Add border styles, AutoSize, improved captions.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8782 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-03-29 17:20:29 +00:00
parent e67b015e3f
commit 3b94b13c57
3 changed files with 251 additions and 45 deletions

View File

@ -14,6 +14,7 @@ type
TForm1 = class(TForm)
btnFont: TButton;
Button1: TButton;
CheckBox1: TCheckBox;
clbBackColor: TColorButton;
clbBarColor: TColorButton;
@ -25,6 +26,8 @@ type
lblMarqueeLength: TLabel;
lblMarqueeSpeed: TLabel;
ProgressBar1: TProgressBar;
RadioGroup1: TRadioGroup;
RadioGroup2: TRadioGroup;
rbNormalStyle: TRadioButton;
rbMarqueeStyle: TRadioButton;
rgOrientation: TRadioGroup;
@ -33,6 +36,7 @@ type
seMarqueeLength: TSpinEdit;
seMarqueeSpeed: TSpinEdit;
procedure btnFontClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure CheckBox1Change(Sender: TObject);
procedure clbBackColorColorChanged(Sender: TObject);
procedure clbBarColorColorChanged(Sender: TObject);
@ -40,6 +44,8 @@ type
procedure clbBorderColorColorChanged(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure RadioGroup2Click(Sender: TObject);
procedure rbNormalStyleChange(Sender: TObject);
procedure rbMarqueeStyleChange(Sender: TObject);
procedure rgDrawingStyleClick(Sender: TObject);
@ -69,6 +75,7 @@ begin
ProgressbarEx.Left := 8;
ProgressbarEx.Top := 8;
ProgressbarEx.Width := 450;
ProgressbarEx.Height := 32;
ProgressbarEx.Parent := self;
Progressbarex.Position := 75;
@ -87,6 +94,21 @@ begin
Height := Width;
end;
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';
tmCustom: ProgressBarEx.Caption := Edit1.Text;
end;
end;
procedure TForm1.RadioGroup2Click(Sender: TObject);
begin
ProgressBarEx.BorderStyle := TProgressBarBorderStyle(RadioGroup2.ItemIndex);
end;
procedure TForm1.rbNormalStyleChange(Sender: TObject);
begin
Progressbar1.style := pbstNormal;
@ -141,6 +163,11 @@ begin
ProgressbarEx.Font := FontDialog1.Font;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ProgressbarEx.AutoSize := true;
end;
procedure TForm1.CheckBox1Change(Sender: TObject);
begin
Progressbar1.Visible := Checkbox1.Checked;
@ -169,8 +196,6 @@ end;
procedure TForm1.ScrollBar1Change(Sender: TObject);
begin
ProgressbarEx.Position := Scrollbar1.Position;
ProgressbarEx.Caption := IntToStr(Scrollbar1.Position);
Progressbar1.Position := Scrollbar1.Position;
end;