You've already forked lazarus-ccr
ExCtrls: New component: TProgressBarEx (https://forum.lazarus.freepascal.org/index.php/topic,62848.0.html)
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8779 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
188
components/exctrls/examples/ProgressBarEx/main.pas
Normal file
188
components/exctrls/examples/ProgressBarEx/main.pas
Normal file
@@ -0,0 +1,188 @@
|
||||
unit main;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ComCtrls,
|
||||
Spin, ExtCtrls, ExProgressbar;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
btnFont: TButton;
|
||||
CheckBox1: TCheckBox;
|
||||
clbBackColor: TColorButton;
|
||||
clbBarColor: TColorButton;
|
||||
clbGradientEndColor: TColorButton;
|
||||
clbBorderColor: TColorButton;
|
||||
Edit1: TEdit;
|
||||
FontDialog1: TFontDialog;
|
||||
GroupBox1: TGroupBox;
|
||||
lblMarqueeLength: TLabel;
|
||||
lblMarqueeSpeed: TLabel;
|
||||
ProgressBar1: TProgressBar;
|
||||
rbNormalStyle: TRadioButton;
|
||||
rbMarqueeStyle: TRadioButton;
|
||||
rgOrientation: TRadioGroup;
|
||||
rgDrawingStyle: TRadioGroup;
|
||||
ScrollBar1: TScrollBar;
|
||||
seMarqueeLength: TSpinEdit;
|
||||
seMarqueeSpeed: TSpinEdit;
|
||||
procedure btnFontClick(Sender: TObject);
|
||||
procedure CheckBox1Change(Sender: TObject);
|
||||
procedure clbBackColorColorChanged(Sender: TObject);
|
||||
procedure clbBarColorColorChanged(Sender: TObject);
|
||||
procedure clbGradientEndColorColorChanged(Sender: TObject);
|
||||
procedure clbBorderColorColorChanged(Sender: TObject);
|
||||
procedure Edit1Change(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure rbNormalStyleChange(Sender: TObject);
|
||||
procedure rbMarqueeStyleChange(Sender: TObject);
|
||||
procedure rgDrawingStyleClick(Sender: TObject);
|
||||
procedure rgOrientationClick(Sender: TObject);
|
||||
procedure ScrollBar1Change(Sender: TObject);
|
||||
procedure seMarqueeLengthChange(Sender: TObject);
|
||||
procedure seMarqueeSpeedChange(Sender: TObject);
|
||||
private
|
||||
ProgressbarEx: TProgressbarEx;
|
||||
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
ProgressbarEx := TProgressbarEx.Create(self);
|
||||
ProgressbarEx.Left := 8;
|
||||
ProgressbarEx.Top := 8;
|
||||
ProgressbarEx.Width := 450;
|
||||
ProgressbarEx.Parent := self;
|
||||
Progressbarex.Position := 75;
|
||||
|
||||
Progressbar1.Left := ProgressbarEx.Left;
|
||||
Progressbar1.Width := ProgressbarEx.Width;
|
||||
|
||||
clbBackColor.ButtonColor := ProgressbarEx.BackColor;
|
||||
clbBarColor.ButtonColor := ProgressbarEx.BarColor;
|
||||
clbGradientEndColor.ButtonColor := ProgressbarEx.GradientEndColor;
|
||||
clbBorderColor.ButtonColor := ProgressbarEx.BorderColor;
|
||||
|
||||
Scrollbar1.Position := ProgressbarEx.Position;
|
||||
Edit1.Hide;
|
||||
|
||||
Width := ProgressbarEx.Width + 2*ProgressbarEx.Left;
|
||||
Height := Width;
|
||||
end;
|
||||
|
||||
procedure TForm1.rbNormalStyleChange(Sender: TObject);
|
||||
begin
|
||||
Progressbar1.style := pbstNormal;
|
||||
ProgressbarEx.Style := pbstNormal;
|
||||
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);
|
||||
begin
|
||||
ProgressbarEx.DrawStyle := TProgressbarDrawStyle(rgDrawingStyle.ItemIndex);
|
||||
end;
|
||||
|
||||
procedure TForm1.rgOrientationClick(Sender: TObject);
|
||||
begin
|
||||
ProgressbarEx.Orientation := TProgressbarOrientation(RgOrientation.ItemIndex);
|
||||
|
||||
Progressbar1.Orientation := ProgressBarEx.Orientation;
|
||||
if Progressbar1.Orientation in [pbVertical, pbTopDown] then
|
||||
begin
|
||||
Progressbar1.Left := 32;
|
||||
Progressbar1.Top := 8;
|
||||
end else
|
||||
begin
|
||||
Progressbar1.Left := 8;
|
||||
Progressbar1.Top := 32;
|
||||
end;
|
||||
Progressbar1.Width := ProgressbarEx.Width;
|
||||
Progressbar1.Height := ProgressbarEx.Height;
|
||||
end;
|
||||
|
||||
procedure TForm1.Edit1Change(Sender: TObject);
|
||||
begin
|
||||
ProgressbarEx.Caption := Edit1.Text;
|
||||
end;
|
||||
|
||||
procedure TForm1.btnFontClick(Sender: TObject);
|
||||
begin
|
||||
FontDialog1.Font := ProgressbarEx.Font;
|
||||
if FontDialog1.Execute then
|
||||
ProgressbarEx.Font := FontDialog1.Font;
|
||||
end;
|
||||
|
||||
procedure TForm1.CheckBox1Change(Sender: TObject);
|
||||
begin
|
||||
Progressbar1.Visible := Checkbox1.Checked;
|
||||
end;
|
||||
|
||||
procedure TForm1.clbBackColorColorChanged(Sender: TObject);
|
||||
begin
|
||||
ProgressbarEx.BackColor := clbBackColor.ButtonColor;
|
||||
end;
|
||||
|
||||
procedure TForm1.clbBarColorColorChanged(Sender: TObject);
|
||||
begin
|
||||
ProgressbarEx.BarColor := clbBarColor.ButtonColor;
|
||||
end;
|
||||
|
||||
procedure TForm1.clbGradientEndColorColorChanged(Sender: TObject);
|
||||
begin
|
||||
ProgressbarEx.GradientEndColor := clbGradientEndColor.ButtonColor;
|
||||
end;
|
||||
|
||||
procedure TForm1.clbBorderColorColorChanged(Sender: TObject);
|
||||
begin
|
||||
ProgressbarEx.BorderColor := clbBorderColor.ButtonColor;
|
||||
end;
|
||||
|
||||
procedure TForm1.ScrollBar1Change(Sender: TObject);
|
||||
begin
|
||||
ProgressbarEx.Position := Scrollbar1.Position;
|
||||
ProgressbarEx.Caption := IntToStr(Scrollbar1.Position);
|
||||
|
||||
Progressbar1.Position := Scrollbar1.Position;
|
||||
end;
|
||||
|
||||
procedure TForm1.seMarqueeLengthChange(Sender: TObject);
|
||||
begin
|
||||
ProgressbarEx.MarqueeLength := seMarqueeLength.Value;
|
||||
end;
|
||||
|
||||
procedure TForm1.seMarqueeSpeedChange(Sender: TObject);
|
||||
begin
|
||||
ProgressbarEx.MarqueeSpeed := seMarqueeSpeed.Value;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user