ExCtrls: Fix TProgressBarEx repainting itself again and again.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8780 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-03-29 11:54:06 +00:00
parent ef7c6a38ac
commit 0cd9c62629
3 changed files with 11 additions and 6 deletions

View File

@ -44,11 +44,6 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
</Unit> </Unit>
<Unit>
<Filename Value="exprogressbar.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ExProgressbar"/>
</Unit>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View File

@ -16,7 +16,8 @@
<Description Value="Extended standard controls: <Description Value="Extended standard controls:
- CurrencyEdit, FloatSIEdit (supports SI units suffixes) - CurrencyEdit, FloatSIEdit (supports SI units suffixes)
- TRadioButton, TCheckbox, TRadioGroup and TCheckGroup: drawn by ThemeServices/Canvas, not by widgetset, button/text layout, wordwrap, user-provided check images - TRadioButton, TCheckbox, TRadioGroup and TCheckGroup: drawn by ThemeServices/Canvas, not by widgetset, button/text layout, wordwrap, user-provided check images
- TColumnComboBoxEx"/> - TColumnComboBoxEx
- TProgressBarEx"/>
<License Value="LGPL with linking exception (like Lazarus LCL)."/> <License Value="LGPL with linking exception (like Lazarus LCL)."/>
<Files Count="9"> <Files Count="9">
<Item1> <Item1>

View File

@ -76,6 +76,8 @@ type
property ParentShowHint; property ParentShowHint;
property ShowHint; property ShowHint;
property Visible; property Visible;
property OnPaint;
end; end;
implementation implementation
@ -86,6 +88,8 @@ uses
constructor TProgressbarEx.Create(AOwner: TComponent); constructor TProgressbarEx.Create(AOwner: TComponent);
begin begin
inherited; inherited;
ControlStyle := ControlStyle - [csSetCaption];
FCaption := ''; FCaption := '';
FColors[0] := DEFAULT_BACKCOLOR; FColors[0] := DEFAULT_BACKCOLOR;
FColors[1] := DEFAULT_BORDERCOLOR; FColors[1] := DEFAULT_BORDERCOLOR;
@ -95,9 +99,12 @@ begin
FMarqueeSpeed := DEFAULT_MARQUEESPEED; FMarqueeSpeed := DEFAULT_MARQUEESPEED;
FMax := 100; FMax := 100;
FStyle := pbstNormal; FStyle := pbstNormal;
FTimer := TTimer.Create(self); FTimer := TTimer.Create(self);
FTimer.Interval := 25; FTimer.Interval := 25;
FTimer.OnTimer := @TimerHandler; FTimer.OnTimer := @TimerHandler;
FTimer.Enabled := false;
with GetControlClassDefaultSize do with GetControlClassDefaultSize do
SetInitialBounds(0, 0, CX, CY); SetInitialBounds(0, 0, CX, CY);
end; end;
@ -303,6 +310,8 @@ begin
else else
Canvas.TextOut((Width - txtSize.CY) div 2, R.Bottom - (Height - txtSize.CX) div 2, FCaption); Canvas.TextOut((Width - txtSize.CY) div 2, R.Bottom - (Height - txtSize.CX) div 2, FCaption);
end; end;
inherited;
end; end;
procedure TProgressbarEx.SetCaption(AValue: String); procedure TProgressbarEx.SetCaption(AValue: String);