You've already forked lazarus-ccr
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8783 8e941d3f-bd1b-0410-a28a-d453659cc2b4
215 lines
5.7 KiB
ObjectPascal
215 lines
5.7 KiB
ObjectPascal
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;
|
|
Button1: TButton;
|
|
CheckBox1: TCheckBox;
|
|
clbBackColor: TColorButton;
|
|
clbBarColor: TColorButton;
|
|
clbGradientEndColor: TColorButton;
|
|
clbBorderColor: TColorButton;
|
|
Edit1: TEdit;
|
|
FontDialog1: TFontDialog;
|
|
GroupBox1: TGroupBox;
|
|
lblMarqueeLength: TLabel;
|
|
lblMarqueeSpeed: TLabel;
|
|
ProgressBar1: TProgressBar;
|
|
RadioGroup1: TRadioGroup;
|
|
RadioGroup2: TRadioGroup;
|
|
rbNormalStyle: TRadioButton;
|
|
rbMarqueeStyle: TRadioButton;
|
|
rgOrientation: TRadioGroup;
|
|
rgDrawingStyle: TRadioGroup;
|
|
ScrollBar1: TScrollBar;
|
|
seMarqueeLength: TSpinEdit;
|
|
seMarqueeSpeed: TSpinEdit;
|
|
procedure btnFontClick(Sender: TObject);
|
|
procedure Button1Click(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 RadioGroup1Click(Sender: TObject);
|
|
procedure RadioGroup2Click(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;
|
|
BarHeight: Integer;
|
|
|
|
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 := 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;
|
|
clbGradientEndColor.ButtonColor := ProgressbarEx.GradientEndColor;
|
|
clbBorderColor.ButtonColor := ProgressbarEx.BorderColor;
|
|
|
|
Scrollbar1.Position := ProgressbarEx.Position;
|
|
|
|
Width := ProgressbarEx.Width + 32;
|
|
Height := Width;
|
|
end;
|
|
|
|
procedure TForm1.RadioGroup1Click(Sender: TObject);
|
|
begin
|
|
ProgressBarEx.TextMode := TProgressbarTextMode(RadioGroup1.ItemIndex);
|
|
case ProgressBarEx.TextMode of
|
|
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;
|
|
|
|
procedure TForm1.RadioGroup2Click(Sender: TObject);
|
|
begin
|
|
ProgressBarEx.BorderStyle := TProgressBarBorderStyle(RadioGroup2.ItemIndex);
|
|
end;
|
|
|
|
procedure TForm1.rbNormalStyleChange(Sender: TObject);
|
|
begin
|
|
Progressbar1.style := pbstNormal;
|
|
ProgressbarEx.Style := pbstNormal;
|
|
ProgressbarEx.Caption := IntToStr(ProgressbarEx.Position);
|
|
Scrollbar1.Position := ProgressbarEx.Position;
|
|
Scrollbar1.Show;
|
|
end;
|
|
|
|
procedure TForm1.rbMarqueeStyleChange(Sender: TObject);
|
|
begin
|
|
Progressbar1.Style := pbstMarquee;
|
|
ProgressbarEx.Style := pbstMarquee;
|
|
Scrollbar1.Hide;
|
|
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 := 40;
|
|
Progressbar1.Top := 8;
|
|
Progressbar1.Width := BarHeight;
|
|
ProgressBar1.Height := ProgressBarEx.Height;
|
|
end else
|
|
begin
|
|
Progressbar1.Left := 8;
|
|
Progressbar1.Top := 40;
|
|
ProgressBar1.Height := BarHeight;
|
|
ProgressBar1.Width := ProgressBarEx.Width;
|
|
end;
|
|
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.Button1Click(Sender: TObject);
|
|
begin
|
|
ProgressbarEx.AutoSize := true;
|
|
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;
|
|
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.
|
|
|