📄 iangulargaugecomponenteditor.pas
字号:
iAngularGauge.OffsetX := OffsetXEdit.AsInteger;
iAngularGauge.OffsetY := OffsetYEdit.AsInteger;
iAngularGauge.AutoCenter := AutoCenterCheckBox.AsBoolean;
iAngularGauge.ShowHub := ShowHubCheckBox.AsBoolean;
iAngularGauge.HubSize := HubSizeEdit.AsInteger;
iAngularGauge.HubColor := HubColorPicker.Color;
iAngularGauge.ReverseScale := ReverseScaleCheckBox.AsBoolean;
iAngularGauge.CachedDrawing := CachedDrawingCheckBox.AsBoolean;
iAngularGauge.Transparent := TransparentCheckBox.AsBoolean;
//-------------- Pointers -----------------------------------------------------------------------------------------------------------------------
iAngularGauge.MinMaxPointerSize := MinMaxPointerSizeEdit.AsInteger;
iAngularGauge.MinMaxPointerMargin := MinMaxPointerMarginEdit.AsInteger;
iAngularGauge.MinMaxFixed := MinMaxFixedCheckBox.AsBoolean;
iAngularGauge.MinMaxUserCanMove := MinMaxUserCanMoveCheckBox.AsBoolean;
iAngularGauge.MinMaxPointerStyle := TiAngularGaugePointerStyle(MinMaxPointerStyleRadioGroup.AsInteger);
iAngularGauge.ShowMaxPointer := ShowMaxPointerCheckBox.AsBoolean;
iAngularGauge.MaxPointerColor := MaxPointerColorPicker.Color;
iAngularGauge.ShowMinPointer := ShowMinPointerCheckBox.AsBoolean;
iAngularGauge.MinPointerColor := MinPointerColorPicker.Color;
iAngularGauge.AutoSize := AutoSizeCheckBox.AsBoolean;
iAngularGauge.OuterMargin := OuterMarginEdit.AsInteger;
//-------------- Ticks --------------------------------------------------------------------------------------------------------------------------
iAngularGauge.TickMargin := TickMarginEdit.AsInteger;
iAngularGauge.ShowTickLabels := ShowTickLabelsCheckBox.AsBoolean;
iAngularGauge.TickLabelPrecision := TickLabelPrecisionEdit.AsInteger;
iAngularGauge.TickLabelMargin := TickLabelMarginEdit.AsInteger;
iAngularGauge.TickLabelAlignment := TiLabelAlignment(TickLabelAlignmentRadioGroup.AsInteger);
iAngularGauge.ShowTicksMajor := ShowTicksMajorCheckBox.AsBoolean;
iAngularGauge.TickMajorCount := TickMajorCountEdit.AsInteger;
iAngularGauge.TickMajorLength := TickMajorLengthEdit.AsInteger;
iAngularGauge.TickMajorColor := TickMajorColorPicker.Color;
iAngularGauge.ShowTicksMinor := ShowTicksMinorCheckBox.AsBoolean;
iAngularGauge.TickMinorCount := TickMinorCountEdit.AsInteger;
iAngularGauge.TickMinorLength := TickMinorLengthEdit.AsInteger;
iAngularGauge.TickMinorColor := TickMinorColorPicker.Color;
iAngularGauge.TickMinorAlignment := TiTickMinorAlignment(TickMinorAlignmentRadioGroup.AsInteger);
//-------------- Sections -----------------------------------------------------------------------------------------------------------------------
iAngularGauge.SectionCount := SectionCountEdit.AsInteger;
iAngularGauge.SectionColor1 := SectionColor1Picker.Color;
iAngularGauge.SectionColor2 := SectionColor2Picker.Color;
iAngularGauge.SectionColor3 := SectionColor3Picker.Color;
iAngularGauge.SectionColor4 := SectionColor4Picker.Color;
iAngularGauge.SectionColor5 := SectionColor5Picker.Color;
iAngularGauge.SectionEnd1 := SectionEnd1Edit.AsFloat;
iAngularGauge.SectionEnd2 := SectionEnd2Edit.AsFloat;
iAngularGauge.SectionEnd3 := SectionEnd3Edit.AsFloat;
iAngularGauge.SectionEnd4 := SectionEnd4Edit.AsFloat;
//-------------- Labels -------------------------------------------------------------------------------------------------------------------------
iAngularGauge.Label1Text := Label1TextEdit.AsString;
iAngularGauge.ShowLabel1 := ShowLabel1CheckBox.AsBoolean;
iAngularGauge.Label1OffsetX := Label1OffsetXEdit.AsInteger;
iAngularGauge.Label1OffsetY := Label1OffsetYEdit.AsInteger;
iAngularGauge.Label1AlignHorizontal := TiAlignmentHorizontal(Label1AlignHorizontalRadioGroup.AsInteger);
iAngularGauge.Label1AlignVertical := TiAlignmentVertical(Label1AlignVerticalRadioGroup.AsInteger);
iAngularGauge.Label2Text := Label2TextEdit.AsString;
iAngularGauge.ShowLabel2 := ShowLabel2CheckBox.AsBoolean;
iAngularGauge.Label2OffsetX := Label2OffsetXEdit.AsInteger;
iAngularGauge.Label2OffsetY := Label2OffsetYEdit.AsInteger;
iAngularGauge.Label2AlignHorizontal := TiAlignmentHorizontal(Label2AlignHorizontalRadioGroup.AsInteger);
iAngularGauge.Label2AlignVertical := TiAlignmentVertical(Label2AlignVerticalRadioGroup.AsInteger);
//-------------- AutoScale -----------------------------------------------------------------------------------------------------------------------
iAngularGauge.AutoScaleDesiredTicks := AutoScaleDesiredTicksEdit.AsInteger;
iAngularGauge.AutoScaleMaxTicks := AutoScaleMaxTicksEdit.AsInteger;
iAngularGauge.AutoScaleStyle := TiAutoScaleStyle(AutoScaleStyleRadioGroup.AsInteger);
iAngularGauge.AutoScaleEnabled := AutoScaleEnabledCheckBox.AsBoolean;
DownLoadOPCProperties(iAngularGauge, iOPCBrowserPanel);
iAngularGauge.RemoveAllPointers;
for x := 0 to FPointerManager.Count-1 do
begin
if x <> 0 then iAngularGauge.AddPointer;
iAngularGauge.Pointers[x].Visible := FPointerManager.Items[x].Visible;
iAngularGauge.Pointers[x].Position := FPointerManager.Items[x].Position;
iAngularGauge.Pointers[x].Size := FPointerManager.Items[x].Size;
iAngularGauge.Pointers[x].Margin := FPointerManager.Items[x].Margin;
iAngularGauge.Pointers[x].Color := FPointerManager.Items[x].Color;
iAngularGauge.Pointers[x].Style := FPointerManager.Items[x].Style;
end;
iAngularGauge.TickLabelFont.Assign(TickLabelFontPicker.Font);
iAngularGauge.Label1Font.Assign(Label1FontPicker.Font);
iAngularGauge.Label2Font.Assign(Label2FontPicker.Font);
FLastPointerIndex := iPointerListBox.ItemIndex;
end;
//****************************************************************************************************************************************************
procedure TiAngularGaugeComponentEditorForm.iComponentEditorFormCreate(Sender: TObject);
begin
FPointerManager := TiGaugePointerManager.Create(ChangeEvent, InsertEvent, RemoveEvent);
UpdatePointers;
end;
//****************************************************************************************************************************************************
procedure TiAngularGaugeComponentEditorForm.iComponentEditorFormDestroy(Sender: TObject);
begin
FPointerManager.Free;
end;
//****************************************************************************************************************************************************
procedure TiAngularGaugeComponentEditorForm.iPointerListBoxClick(Sender: TObject);
begin
UpdatePointers;
end;
//****************************************************************************************************************************************************
procedure TiAngularGaugeComponentEditorForm.iPointerListBoxGetData(const Index: Integer; var DrawColorBox: Boolean; var AColor: TColor; var AText: String);
begin
AColor := (iPointerListBox.Items.Objects[Index] as TiGaugePointer).Color;
AText := 'Pointer(' + IntToStr(Index) + ')';
end;
//****************************************************************************************************************************************************
procedure TiAngularGaugeComponentEditorForm.ChangeEvent(Sender: TObject);
begin
end;
//****************************************************************************************************************************************************
procedure TiAngularGaugeComponentEditorForm.InsertEvent(Sender: TObject);
begin
if Sender is TiGaugePointer then iPointerListBox.Items.AddObject('',Sender);
iPointerListBox.SelectLast;
end;
//****************************************************************************************************************************************************
procedure TiAngularGaugeComponentEditorForm.RemoveEvent(Sender: TObject);
begin
iPointerListBox.Items.Delete(iPointerListBox.Items.IndexOfObject(Sender));
end;
//****************************************************************************************************************************************************
procedure TiAngularGaugeComponentEditorForm.iPointerAddButtonClick(Sender: TObject);
begin
FPointerManager.Add;
UpdatePointers;
Modified := True;
end;
//****************************************************************************************************************************************************
procedure TiAngularGaugeComponentEditorForm.PointerRemoveButtonClick(Sender: TObject);
begin
iPointerListBox.DeleteSelectedObject;
UpdatePointers;
Modified := True;
end;
//****************************************************************************************************************************************************
procedure TiAngularGaugeComponentEditorForm.PositionEditChange(Sender: TObject);
begin
FPointerManager.Items[0].Position := PositionEdit.AsFloat;
UpdatePointers;
end;
//****************************************************************************************************************************************************
procedure TiAngularGaugeComponentEditorForm.UpdatePointers;
var
iPointer : TiGaugePointer;
begin
if iPointerListBox.ItemIndex = - 1 then DisableAllEditControlsStartingWith('Pointer')
else
begin
EnableAllEditControlsStartingWith('Pointer');
iPointer := iPointerListBox.Items.Objects[iPointerListBox.ItemIndex] as TiGaugePointer;
PointerVisibleCheckBox.AsBoolean := iPointer.Visible;
PointerPositionEdit.AsFloat := iPointer.Position;
PointerSizeEdit.AsInteger := iPointer.Size;
PointerMarginEdit.AsInteger := iPointer.Margin;
PointerColorPicker.Color := iPointer.Color;
PointerStyleRadioGroup.AsInteger := iPointer.Style;
iPointerListBox.Invalidate;
if iPointerListBox.ItemIndex = 0 then PointerRemoveButton.Enabled := False;
end;
end;
//****************************************************************************************************************************************************
procedure TiAngularGaugeComponentEditorForm.PointerChange(Sender: TObject);
var
iPointer : TiGaugePointer;
begin
if iPointerListBox.ItemIndex = -1 then exit;
iPointer := iPointerListBox.Items.Objects[iPointerListBox.ItemIndex] as TiGaugePointer;
iPointer.Visible := PointerVisibleCheckBox.AsBoolean;
iPointer.Position := PointerPositionEdit.AsFloat;
iPointer.Size := PointerSizeEdit.AsInteger;
iPointer.Margin := PointerMarginEdit.AsInteger;
iPointer.Color := PointerColorPicker.Color;
iPointer.Style := PointerStyleRadioGroup.AsInteger;
if iPointerListBox.ItemIndex = 0 then
begin
PositionEdit.AsFloat := PointerPositionEdit.AsFloat;
end;
UpdatePointers;
end;
//****************************************************************************************************************************************************
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -