📄 dlgscalesettings.pas
字号:
unit DlgScaleSettings;
{******************************************************************************}
{ Abakus VCL }
{ Property-editor to adjust ScaleSettings }
{ belongs to all analog indicators }
{ }
{******************************************************************************}
{ e-Mail: support@abaecker.de , Web: http://www.abaecker.com }
{------------------------------------------------------------------------------}
{ (c) Copyright 1998..2001 A.Baecker, All rights Reserved }
{******************************************************************************}
{$I Abks.inc}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
_GClass, StdCtrls, AbCBitBt, Buttons, AbNumEdit,
{$IFDEF D6} DesignWindows, DesignEditors, DesignIntf, {$ELSE} DsgnIntf, {$ENDIF}
_AbProc;
type
TAbScaleSettings_Form = class(TForm)
ColorBitBtn: TAbColBitBtn;
Label1: TLabel;
PointerColorBitBtn: TAbColBitBtn;
Label2: TLabel;
ColorDialog1: TColorDialog;
FontDialog1: TFontDialog;
Ok_BitBtn: TBitBtn;
Cancel_BitBtn: TBitBtn;
Font_Btn: TSpeedButton;
PosLeftTop_CheckBox: TCheckBox;
DrawLine_CheckBox: TCheckBox;
StepsSpin: TAbNumSpin;
SubStepsSpin: TAbNumSpin;
Label3: TLabel;
Label4: TLabel;
ValueFormat_Edit: TEdit;
ValueFormatLog_Edit: TEdit;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
procedure DrawLine_CheckBoxClick(Sender: TObject);
procedure PosLeftTop_CheckBoxClick(Sender: TObject);
procedure StepsSpinValueChanged(Sender: TObject);
procedure SubStepsSpinValueChanged(Sender: TObject);
procedure ValueFormat_EditChange(Sender: TObject);
procedure ValueFormatLog_EditChange(Sender: TObject);
procedure ColorBitBtnClick(Sender: TObject);
procedure PointerColorBitBtnClick(Sender: TObject);
procedure Font_BtnClick(Sender: TObject);
private
{ Private-Deklarationen }
procedure GetSettings;
public
{ Public-Deklarationen }
end;
TAbScaleSettingsEditor = class(TClassProperty)
public
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
// function GetValue: string; override;
end;
var
AbScaleSettings_Form: TAbScaleSettings_Form;
SclSettings : TScaleSettings;
implementation
{$R *.DFM}
procedure TAbScaleSettingsEditor.Edit;
var
SclSettings2 : TScaleSettings;
TmpSettings : TScaleSettings;
n : Integer;
begin
TmpSettings := TScaleSettings.create;
AbScaleSettings_Form := TAbScaleSettings_Form.create(Application);
AbLoadFormPos(AbScaleSettings_Form);
try
with
AbScaleSettings_Form do begin
SclSettings := TScaleSettings(GetOrdValue);
TmpSettings.Assign(SclSettings); // save old settings
GetSettings;
if ShowModal = mrOK then begin
Modified;
for n := 1 to PropCount-1 do begin
SclSettings2 := TScaleSettings(GetOrdValueAt(n));
SclSettings2.Assign(SclSettings);
end;
end else begin
SclSettings.Assign(TmpSettings); // restore old settings
end;
end;
finally
AbSaveFormPos(AbScaleSettings_Form);
AbScaleSettings_Form.Free;
TmpSettings.free;
end;
end;
function TAbScaleSettingsEditor.GetAttributes: TPropertyAttributes;
begin
Result := [paMultiSelect, paSubProperties, paAutoUpdate, paDialog, paReadOnly];
end;
{function TAbScaleSettingsEditor.GetValue: string;
begin
result := '(TScaleSettings)';
end;
}
procedure TAbScaleSettings_Form.GetSettings;
begin
with SclSettings do begin
PointerColorBitBtn.ColorOff := PointerColor;
PointerColorBitBtn.ColorOn := PointerColor;
ColorBitBtn.ColorOff := SclSettings.Color;
ColorBitBtn.ColorOn := SclSettings.Color;
DrawLine_CheckBox.Checked := DrawLine;
PosLeftTop_CheckBox.Checked := PosLeftTop;
StepsSpin.Value := Steps;
SubStepsSpin.Value := SubSteps;
ValueFormat_Edit.Text := ValueFormat;
ValueFormatLog_Edit.Text := ValueFormatLog;
Label7.Visible := LogScale;
if Logscale then Label6.Font.Color := clBlack else
Label6.Font.Color := clBtnShadow;
end;
end;
procedure TAbScaleSettings_Form.DrawLine_CheckBoxClick(
Sender: TObject);
begin
SclSettings.DrawLine := DrawLine_CheckBox.Checked;
end;
procedure TAbScaleSettings_Form.PosLeftTop_CheckBoxClick(
Sender: TObject);
begin
SclSettings.PosLeftTop := PosLeftTop_CheckBox.Checked;
end;
procedure TAbScaleSettings_Form.StepsSpinValueChanged(
Sender: TObject);
begin
SclSettings.Steps := StepsSpin.ValueAsInt;
end;
procedure TAbScaleSettings_Form.SubStepsSpinValueChanged(
Sender: TObject);
begin
SclSettings.SubSteps := SubStepsSpin.ValueAsInt;
end;
procedure TAbScaleSettings_Form.ValueFormat_EditChange(
Sender: TObject);
begin
SclSettings.ValueFormat := ValueFormat_Edit.Text;
end;
procedure TAbScaleSettings_Form.ValueFormatLog_EditChange(
Sender: TObject);
begin
SclSettings.ValueFormatLog := ValueFormatLog_Edit.Text;
end;
procedure TAbScaleSettings_Form.ColorBitBtnClick(Sender: TObject);
begin
ColorDialog1.Color := SclSettings.Color;
if ColorDialog1.Execute then SclSettings.Color := ColorDialog1.Color;
GetSettings;
end;
procedure TAbScaleSettings_Form.PointerColorBitBtnClick(
Sender: TObject);
begin
ColorDialog1.Color := SclSettings.PointerColor;
if ColorDialog1.Execute then SclSettings.PointerColor := ColorDialog1.Color;
GetSettings;
end;
procedure TAbScaleSettings_Form.Font_BtnClick(Sender: TObject);
begin
FontDialog1.Font.Assign(SclSettings.Font);
if FontDialog1.Execute then begin
SclSettings.Font.Assign(FontDialog1.Font);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -