📄 iangulargaugecomponenteditor.pas
字号:
ShowInnerArcRadiusCheckBox: TiComponentEditorCheckBox;
ShowOuterArcRadiusCheckBox: TiComponentEditorCheckBox;
ReverseScaleCheckBox: TiComponentEditorCheckBox;
AutoCenterCheckBox: TiComponentEditorCheckBox;
AutoSizeCheckBox: TiComponentEditorCheckBox;
Label3: TLabel;
Label49: TLabel;
OuterMarginUpDown: TiUpDown;
BackGroundColorPicker: TiComponentEditorColorPicker;
BorderStyleRadioGroup: TiComponentEditorRadioGroup;
OuterMarginEdit: TiComponentEditorEdit;
PrecisionStyleRadioGroup: TiComponentEditorRadioGroup;
Label76: TLabel;
UpdateFrameRateUpDown: TiUpDown;
UpdateFrameRateEdit: TiComponentEditorEdit;
AutoFrameRateCheckBox: TiComponentEditorCheckBox;
PointerVisibleCheckBox: TiComponentEditorCheckBox;
procedure iPointerListBoxGetData(const Index: Integer; var DrawColorBox: Boolean; var AColor: TColor; var AText: String);
procedure iComponentEditorFormCreate(Sender: TObject);
procedure iPointerAddButtonClick(Sender: TObject);
procedure PointerChange(Sender: TObject);
procedure iPointerListBoxClick(Sender: TObject);
procedure PointerRemoveButtonClick(Sender: TObject);
procedure iComponentEditorFormDestroy(Sender: TObject);
procedure PositionEditChange(Sender: TObject);
private
FPointerManager : TiGaugePointerManager;
FLastPointerIndex : Integer;
protected
procedure CreateThemeInstance; override;
procedure CopyPropertiesToForm (Component: TWinControl); override;
procedure CopyPropertiesToComponent(Component: TWinControl); override;
procedure InsertEvent(Sender: TObject);
procedure RemoveEvent(Sender: TObject);
procedure ChangeEvent(Sender: TObject);
procedure UpdatePointers;
end;
var
iAngularGaugeComponentEditorForm: TiAngularGaugeComponentEditorForm;
implementation
{$R *.dfm}
//****************************************************************************************************************************************************
procedure TiAngularGaugeComponentEditorForm.CreateThemeInstance();
begin
iThemeInstance := TiAngularGauge.Create(Self);
end;
//****************************************************************************************************************************************************
procedure TiAngularGaugeComponentEditorForm.CopyPropertiesToForm(Component: TWinControl);
var
iAngularGauge : TiAngularGauge;
x : Integer;
begin
iAngularGauge := Component as TiAngularGauge;
//-------------- General ---------------------------------------------------------------------------------------------------------------------------
PositionEdit.AsFloat := iAngularGauge.Position;
PositionMaxEdit.AsFloat := iAngularGauge.PositionMax;
PositionMinEdit.AsFloat := iAngularGauge.PositionMin;
CurrentMaxEdit.AsFloat := iAngularGauge.CurrentMax;
CurrentMinEdit.AsFloat := iAngularGauge.CurrentMin;
ShowInnerArcRadiusCheckBox.AsBoolean := iAngularGauge.ShowInnerArcRadius;
ShowOuterArcRadiusCheckBox.AsBoolean := iAngularGauge.ShowOuterArcRadius;
BackGroundColorPicker.Color := iAngularGauge.BackGroundColor;
AutoFrameRateCheckBox.AsBoolean := iAngularGauge.AutoFrameRate;
UpdateFrameRateEdit.AsInteger := iAngularGauge.UpdateFrameRate;
BorderStyleRadioGroup.AsInteger := ord(iAngularGauge.BorderStyle);
PrecisionStyleRadioGroup.AsInteger := ord(iAngularGauge.PrecisionStyle);
ArcRadiusEdit.AsInteger := iAngularGauge.ArcRadius;
ArcRangeDegreesEdit.AsInteger := iAngularGauge.ArcRangeDegrees;
ArcStartDegreesEdit.AsInteger := iAngularGauge.ArcStartDegrees;
OffsetXEdit.AsInteger := iAngularGauge.OffsetX;
OffsetYEdit.AsInteger := iAngularGauge.OffsetY;
AutoCenterCheckBox.AsBoolean := iAngularGauge.AutoCenter;
ShowHubCheckBox.AsBoolean := iAngularGauge.ShowHub;
HubSizeEdit.AsInteger := iAngularGauge.HubSize;
HubColorPicker.Color := iAngularGauge.HubColor;
ReverseScaleCheckBox.AsBoolean := iAngularGauge.ReverseScale;
CachedDrawingCheckBox.AsBoolean := iAngularGauge.CachedDrawing;
TransparentCheckBox.AsBoolean := iAngularGauge.Transparent;
AutoSizeCheckBox.AsBoolean := iAngularGauge.AutoSize;
OuterMarginEdit.AsInteger := iAngularGauge.OuterMargin;
//-------------- Pointers -------------------------------------------------------------------------------------------------------------------
MinMaxPointerSizeEdit.AsInteger := iAngularGauge.MinMaxPointerSize;
MinMaxPointerMarginEdit.AsInteger := iAngularGauge.MinMaxPointerMargin;
MinMaxFixedCheckBox.AsBoolean := iAngularGauge.MinMaxFixed;
MinMaxUserCanMoveCheckBox.AsBoolean := iAngularGauge.MinMaxUserCanMove;
MinMaxPointerStyleRadioGroup.AsInteger := ord(iAngularGauge.MinMaxPointerStyle);
ShowMaxPointerCheckBox.AsBoolean := iAngularGauge.ShowMaxPointer;
MaxPointerColorPicker.Color := iAngularGauge.MaxPointerColor;
ShowMinPointerCheckBox.AsBoolean := iAngularGauge.ShowMinPointer;
MinPointerColorPicker.Color := iAngularGauge.MinPointerColor;
//-------------- Ticks ----------------------------------------------------------------------------------------------------------------------
TickMarginEdit.AsInteger := iAngularGauge.TickMargin;
ShowTickLabelsCheckBox.AsBoolean := iAngularGauge.ShowTickLabels;
TickLabelPrecisionEdit.AsInteger := iAngularGauge.TickLabelPrecision;
TickLabelMarginEdit.AsInteger := iAngularGauge.TickLabelMargin;
TickLabelAlignmentRadioGroup.AsInteger := ord(iAngularGauge.TickLabelAlignment);
ShowTicksMajorCheckBox.AsBoolean := iAngularGauge.ShowTicksMajor;
TickMajorCountEdit.AsInteger := iAngularGauge.TickMajorCount;
TickMajorLengthEdit.AsInteger := iAngularGauge.TickMajorLength;
TickMajorColorPicker.Color := iAngularGauge.TickMajorColor;
ShowTicksMinorCheckBox.AsBoolean := iAngularGauge.ShowTicksMinor;
TickMinorCountEdit.AsInteger := iAngularGauge.TickMinorCount;
TickMinorLengthEdit.AsInteger := iAngularGauge.TickMinorLength;
TickMinorColorPicker.Color := iAngularGauge.TickMinorColor;
TickMinorAlignmentRadioGroup.AsInteger := ord(iAngularGauge.TickMinorAlignment);
//-------------- Sections -------------------------------------------------------------------------------------------------------------------
SectionCountEdit.AsInteger := iAngularGauge.SectionCount;
SectionColor1Picker.Color := iAngularGauge.SectionColor1;
SectionColor2Picker.Color := iAngularGauge.SectionColor2;
SectionColor3Picker.Color := iAngularGauge.SectionColor3;
SectionColor4Picker.Color := iAngularGauge.SectionColor4;
SectionColor5Picker.Color := iAngularGauge.SectionColor5;
SectionEnd1Edit.AsFloat := iAngularGauge.SectionEnd1;
SectionEnd2Edit.AsFloat := iAngularGauge.SectionEnd2;
SectionEnd3Edit.AsFloat := iAngularGauge.SectionEnd3;
SectionEnd4Edit.AsFloat := iAngularGauge.SectionEnd4;
//-------------- Labels ---------------------------------------------------------------------------------------------------------------------
Label1TextEdit.AsString := iAngularGauge.Label1Text;
ShowLabel1CheckBox.AsBoolean := iAngularGauge.ShowLabel1;
Label1OffsetXEdit.AsInteger := iAngularGauge.Label1OffsetX;
Label1OffsetYEdit.AsInteger := iAngularGauge.Label1OffsetY;
Label1AlignHorizontalRadioGroup.AsInteger := ord(iAngularGauge.Label1AlignHorizontal);
Label1AlignVerticalRadioGroup.AsInteger := ord(iAngularGauge.Label1AlignVertical);
Label2TextEdit.AsString := iAngularGauge.Label2Text;
ShowLabel2CheckBox.AsBoolean := iAngularGauge.ShowLabel2;
Label2OffsetXEdit.AsInteger := iAngularGauge.Label2OffsetX;
Label2OffsetYEdit.AsInteger := iAngularGauge.Label2OffsetY;
Label2AlignHorizontalRadioGroup.AsInteger := ord(iAngularGauge.Label2AlignHorizontal);
Label2AlignVerticalRadioGroup.AsInteger := ord(iAngularGauge.Label2AlignVertical);
//-------------- AutoScale -------------------------------------------------------------------------------------------------------------------
AutoScaleDesiredTicksEdit.AsInteger := iAngularGauge.AutoScaleDesiredTicks;
AutoScaleMaxTicksEdit.AsInteger := iAngularGauge.AutoScaleMaxTicks;
AutoScaleEnabledCheckBox.AsBoolean := iAngularGauge.AutoScaleEnabled;
AutoScaleStyleRadioGroup.AsInteger := ord(iAngularGauge.AutoScaleStyle);
UpLoadOPCProperties(iAngularGauge, iOPCBrowserPanel);
FPointerManager.Clear;
for x := 0 to iAngularGauge.PointerCount-1 do
begin
FPointerManager.Add;
FPointerManager.Items[x].Visible := iAngularGauge.Pointers[x].Visible;
FPointerManager.Items[x].Position := iAngularGauge.Pointers[x].Position;
FPointerManager.Items[x].Size := iAngularGauge.Pointers[x].Size;
FPointerManager.Items[x].Margin := iAngularGauge.Pointers[x].Margin;
FPointerManager.Items[x].Color := iAngularGauge.Pointers[x].Color;
FPointerManager.Items[x].Style := iAngularGauge.Pointers[x].Style;
end;
TickLabelFontPicker.Font.Assign(iAngularGauge.TickLabelFont);
Label1FontPicker.Font.Assign(iAngularGauge.Label1Font);
Label2FontPicker.Font.Assign(iAngularGauge.Label2Font);
if iPointerListBox.Items.Count > FLastPointerIndex then iPointerListBox.ItemIndex := FLastPointerIndex;
UpdatePointers;
end;
//****************************************************************************************************************************************************
procedure TiAngularGaugeComponentEditorForm.CopyPropertiesToComponent(Component: TWinControl);
var
iAngularGauge : TiAngularGauge;
x : Integer;
begin
iAngularGauge := Component as TiAngularGauge;
//-------------- General ---------------------------------------------------------------------------------------------------------------------------
iAngularGauge.AutoScaleEnabled := False; //Required to set Min & Max before AutoScale Activates
iAngularGauge.PositionMin := PositionMinEdit.AsFloat;
iAngularGauge.PositionMax := PositionMaxEdit.AsFloat;
iAngularGauge.CurrentMax := CurrentMaxEdit.AsFloat;
iAngularGauge.CurrentMin := CurrentMinEdit.AsFloat;
iAngularGauge.ShowInnerArcRadius := ShowInnerArcRadiusCheckBox.AsBoolean;
iAngularGauge.ShowOuterArcRadius := ShowOuterArcRadiusCheckBox.AsBoolean;
iAngularGauge.BackGroundColor := BackGroundColorPicker.Color;
iAngularGauge.AutoFrameRate := AutoFrameRateCheckBox.AsBoolean;
iAngularGauge.UpdateFrameRate := UpdateFrameRateEdit.AsInteger;
iAngularGauge.BorderStyle := TiBevelStyle(BorderStyleRadioGroup.AsInteger);
iAngularGauge.PrecisionStyle := TiPrecisionStyle(PrecisionStyleRadioGroup.AsInteger);
iAngularGauge.ArcRadius := ArcRadiusEdit.AsInteger;
iAngularGauge.ArcRangeDegrees := ArcRangeDegreesEdit.AsInteger;
iAngularGauge.ArcStartDegrees := ArcStartDegreesEdit.AsInteger;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -