📄 iloggaugecomponenteditor.pas
字号:
TickMinorColorPicker.Color := iLogGauge.TickMinorColor;
TickMinorAlignmentRadioGroup.AsInteger := ord(iLogGauge.TickMinorAlignment);
TickMinorStyleRadioGroup.AsInteger := ord(iLogGauge.TickMinorStyle);
//-------------- Sections --------------------------------------------------------------------------------------------------------------------------
SectionCountEdit.AsInteger := iLogGauge.SectionCount;
SectionColor1Picker.Color := iLogGauge.SectionColor1;
SectionColor2Picker.Color := iLogGauge.SectionColor2;
SectionColor3Picker.Color := iLogGauge.SectionColor3;
SectionColor4Picker.Color := iLogGauge.SectionColor4;
SectionColor5Picker.Color := iLogGauge.SectionColor5;
SectionEnd1Edit.AsFloat := iLogGauge.SectionEnd1;
SectionEnd2Edit.AsFloat := iLogGauge.SectionEnd2;
SectionEnd3Edit.AsFloat := iLogGauge.SectionEnd3;
SectionEnd4Edit.AsFloat := iLogGauge.SectionEnd4;
UpLoadOPCProperties(iLogGauge, iOPCBrowserPanel);
FPointerManager.Clear;
for x := 0 to iLogGauge.PointerCount-1 do
begin
FPointerManager.Add;
FPointerManager.Items[x].Visible := iLogGauge.Pointers[x].Visible;
FPointerManager.Items[x].Position := iLogGauge.Pointers[x].Position;
FPointerManager.Items[x].Size := iLogGauge.Pointers[x].Size;
FPointerManager.Items[x].Margin := iLogGauge.Pointers[x].Margin;
FPointerManager.Items[x].Color := iLogGauge.Pointers[x].Color;
FPointerManager.Items[x].Style := iLogGauge.Pointers[x].Style;
end;
TickLabelFontPicker.Font.Assign(iLogGauge.TickLabelFont);
if iPointerListBox.Items.Count > FLastPointerIndex then iPointerListBox.ItemIndex := FLastPointerIndex;
UpdatePointers;
end;
//****************************************************************************************************************************************************
procedure TiLogGaugeComponentEditorForm.CopyPropertiesToComponent(Component: TWinControl);
var
iLogGauge : TiLogGauge;
x : Integer;
begin
iLogGauge := Component as TiLogGauge;
//-------------- General ---------------------------------------------------------------------------------------------------------------------------
iLogGauge.Position := PositionEdit.AsFloat;
iLogGauge.PositionMax := PositionMaxEdit.AsFloat;
iLogGauge.PositionMin := PositionMinEdit.AsFloat;
iLogGauge.CurrentMax := CurrentMaxEdit.AsFloat;
iLogGauge.CurrentMin := CurrentMinEdit.AsFloat;
iLogGauge.EndsMargin := EndsMarginEdit.AsInteger;
iLogGauge.BackGroundColor := BackGroundColorPicker.Color;
iLogGauge.AutoFrameRate := AutoFrameRateCheckBox.AsBoolean;
iLogGauge.AutoCenter := AutoCenterCheckBox.AsBoolean;
iLogGauge.UpdateFrameRate := UpdateFrameRateEdit.AsInteger;
iLogGauge.BorderStyle := TiBevelStyle(BorderStyleRadioGroup.AsInteger);
iLogGauge.Orientation := TiOrientation(OrientationRadioGroup.AsInteger);
iLogGauge.OrientationTickMarks := TiOrientationSide(OrientationTickMarksRadioGroup.AsInteger);
iLogGauge.ReverseScale := ReverseScaleCheckBox.AsBoolean;
iLogGauge.CachedDrawing := CachedDrawingCheckBox.AsBoolean;
iLogGauge.Transparent := TransparentCheckBox.AsBoolean;
iLogGauge.OffsetX := OffsetXEdit.AsInteger;
iLogGauge.OffsetY := OffsetYEdit.AsInteger;
//-------------- Pointers --------------------------------------------------------------------------------------------------------------------------
iLogGauge.PointerOffSet := PointerOffsetEdit.AsInteger;
iLogGauge.PointerSize := PointerSizeEdit.AsInteger;
iLogGauge.PointerStyle := TiLinearGaugePointerStyle(PointerStyleRadioGroup.AsInteger);
iLogGauge.PointerColor := PointerColorPicker.Color;
iLogGauge.MinMaxPointerSize := MinMaxPointerSizeEdit.AsInteger;
iLogGauge.MinMaxPointerMargin := MinMaxPointerMarginEdit.AsInteger;
iLogGauge.MinMaxFixed := MinMaxFixedCheckBox.AsBoolean;
iLogGauge.MinMaxUserCanMove := MinMaxUserCanMoveCheckBox.AsBoolean;
iLogGauge.ShowMaxPointer := ShowMaxPointerCheckBox.AsBoolean;
iLogGauge.MaxPointerColor := MaxPointerColorPicker.Color;
iLogGauge.ShowMinPointer := ShowMinPointerCheckBox.AsBoolean;
iLogGauge.MinPointerColor := MinPointerColorPicker.Color;
//-------------- Ticks -----------------------------------------------------------------------------------------------------------------------------
iLogGauge.ShowTicksAxis := ShowTicksAxisCheckBox.AsBoolean;
iLogGauge.TickMargin := TickMarginEdit.AsInteger;
iLogGauge.TickLabelPrecision := TickLabelPrecisionEdit.AsInteger;
iLogGauge.TickLabelMargin := TickLabelMarginEdit.AsInteger;
iLogGauge.TickLabelStyle := TiLogLabelStyle(TickLabelStyleRadioGroup.AsInteger);
iLogGauge.TickMajorLength := TickMajorLengthEdit.AsInteger;
iLogGauge.TickMajorColor := TickMajorColorPicker.Color;
iLogGauge.TickMajorStyle := TiBevelStyle(TickMajorStyleRadioGroup.AsInteger);
iLogGauge.TickMinorLength := TickMinorLengthEdit.AsInteger;
iLogGauge.TickMinorColor := TickMinorColorPicker.Color;
iLogGauge.TickMinorAlignment := TiTickMinorAlignment(TickMinorAlignmentRadioGroup.AsInteger);
iLogGauge.TickMinorStyle := TiBevelStyle(TickMinorStyleRadioGroup.AsInteger);
//-------------- Sections --------------------------------------------------------------------------------------------------------------------------
iLogGauge.SectionCount := SectionCountEdit.AsInteger;
iLogGauge.SectionColor1 := SectionColor1Picker.Color;
iLogGauge.SectionColor2 := SectionColor2Picker.Color;
iLogGauge.SectionColor3 := SectionColor3Picker.Color;
iLogGauge.SectionColor4 := SectionColor4Picker.Color;
iLogGauge.SectionColor5 := SectionColor5Picker.Color;
iLogGauge.SectionEnd1 := SectionEnd1Edit.AsFloat;
iLogGauge.SectionEnd2 := SectionEnd2Edit.AsFloat;
iLogGauge.SectionEnd3 := SectionEnd3Edit.AsFloat;
iLogGauge.SectionEnd4 := SectionEnd4Edit.AsFloat;
DownLoadOPCProperties(iLogGauge, iOPCBrowserPanel);
iLogGauge.RemoveAllPointers;
for x := 0 to FPointerManager.Count-1 do
begin
if x <> 0 then iLogGauge.AddPointer;
iLogGauge.Pointers[x].Visible := FPointerManager.Items[x].Visible;
iLogGauge.Pointers[x].Position := FPointerManager.Items[x].Position;
iLogGauge.Pointers[x].Size := FPointerManager.Items[x].Size;
iLogGauge.Pointers[x].Margin := FPointerManager.Items[x].Margin;
iLogGauge.Pointers[x].Color := FPointerManager.Items[x].Color;
iLogGauge.Pointers[x].Style := FPointerManager.Items[x].Style;
end;
iLogGauge.TickLabelFont.Assign(TickLabelFontPicker.Font);
FLastPointerIndex := iPointerListBox.ItemIndex;
end;
//****************************************************************************************************************************************************
procedure TiLogGaugeComponentEditorForm.iComponentEditorFormCreate(Sender: TObject);
begin
FPointerManager := TiGaugePointerManager.Create(ChangeEvent, InsertEvent, RemoveEvent);
UpdatePointers;
end;
//****************************************************************************************************************************************************
procedure TiLogGaugeComponentEditorForm.iComponentEditorFormDestroy(Sender: TObject);
begin
FPointerManager.Free;
end;
//****************************************************************************************************************************************************
procedure TiLogGaugeComponentEditorForm.iPointerListBoxClick(Sender: TObject);
begin
UpdatePointers;
end;
//****************************************************************************************************************************************************
procedure TiLogGaugeComponentEditorForm.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 TiLogGaugeComponentEditorForm.ChangeEvent(Sender: TObject);
begin
end;
//****************************************************************************************************************************************************
procedure TiLogGaugeComponentEditorForm.InsertEvent(Sender: TObject);
begin
if Sender is TiGaugePointer then
begin
iPointerListBox.Items.AddObject('',Sender);
with Sender as TiGaugePointer do
begin
Position := 1;
Size := 10;
Color := clBlue;
Style := ord(ilgpsPointer);
end;
iPointerListBox.SelectLast;
end;
end;
//****************************************************************************************************************************************************
procedure TiLogGaugeComponentEditorForm.RemoveEvent(Sender: TObject);
begin
iPointerListBox.Items.Delete(iPointerListBox.Items.IndexOfObject(Sender));
end;
//****************************************************************************************************************************************************
procedure TiLogGaugeComponentEditorForm.iPointerAddButtonClick(Sender: TObject);
begin
FPointerManager.Add;
UpdatePointers;
Modified := True;
end;
//****************************************************************************************************************************************************
procedure TiLogGaugeComponentEditorForm.PointerRemoveButtonClick(Sender: TObject);
begin
iPointerListBox.DeleteSelectedObject;
UpdatePointers;
Modified := True;
end;
//****************************************************************************************************************************************************
procedure TiLogGaugeComponentEditorForm.PositionEditChange(Sender: TObject);
begin
FPointerManager.Items[0].Position := PositionEdit.AsFloat;
UpdatePointers;
end;
//****************************************************************************************************************************************************
procedure TiLogGaugeComponentEditorForm.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;
PointerOffSetEdit.AsInteger := iPointer.Margin;
PointerColorPicker.Color := iPointer.Color;
PointerStyleRadioGroup.AsInteger := iPointer.Style;
iPointerListBox.Invalidate;
if iPointerListBox.ItemIndex = 0 then PointerRemoveButton.Enabled := False;
end;
end;
//****************************************************************************************************************************************************
procedure TiLogGaugeComponentEditorForm.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 := PointerOffSetEdit.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 + -