⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iangularloggaugecomponenteditor.pas

📁 iocopm3.04源码,一套很好的工控开发工具
💻 PAS
📖 第 1 页 / 共 2 页
字号:

  TickLabelPrecisionEdit.AsInteger          := iAngularLogGauge.TickLabelPrecision;
  TickLabelMarginEdit.AsInteger             := iAngularLogGauge.TickLabelMargin;
  TickLabelStyleRadioGroup.AsInteger        := ord(iAngularLogGauge.TickLabelStyle);

  TickMajorLengthEdit.AsInteger             := iAngularLogGauge.TickMajorLength;
  TickMajorColorPicker.Color                := iAngularLogGauge.TickMajorColor;

  TickMinorLengthEdit.AsInteger             := iAngularLogGauge.TickMinorLength;
  TickMinorColorPicker.Color                := iAngularLogGauge.TickMinorColor;
  TickMinorAlignmentRadioGroup.AsInteger    := ord(iAngularLogGauge.TickMinorAlignment);
  //-------------- Sections -------------------------------------------------------------------------------------------------------------------
  SectionCountEdit.AsInteger                := iAngularLogGauge.SectionCount;

  SectionColor1Picker.Color                 := iAngularLogGauge.SectionColor1;
  SectionColor2Picker.Color                 := iAngularLogGauge.SectionColor2;
  SectionColor3Picker.Color                 := iAngularLogGauge.SectionColor3;
  SectionColor4Picker.Color                 := iAngularLogGauge.SectionColor4;
  SectionColor5Picker.Color                 := iAngularLogGauge.SectionColor5;

  SectionEnd1Edit.AsFloat                   := iAngularLogGauge.SectionEnd1;
  SectionEnd2Edit.AsFloat                   := iAngularLogGauge.SectionEnd2;
  SectionEnd3Edit.AsFloat                   := iAngularLogGauge.SectionEnd3;
  SectionEnd4Edit.AsFloat                   := iAngularLogGauge.SectionEnd4;
  //-------------- Labels ---------------------------------------------------------------------------------------------------------------------
  Label1TextEdit.AsString                   := iAngularLogGauge.Label1Text;
  ShowLabel1CheckBox.AsBoolean              := iAngularLogGauge.ShowLabel1;
  Label1OffsetXEdit.AsInteger               := iAngularLogGauge.Label1OffsetX;
  Label1OffsetYEdit.AsInteger               := iAngularLogGauge.Label1OffsetY;
  Label1AlignHorizontalRadioGroup.AsInteger := ord(iAngularLogGauge.Label1AlignHorizontal);
  Label1AlignVerticalRadioGroup.AsInteger   := ord(iAngularLogGauge.Label1AlignVertical);

  Label2TextEdit.AsString                   := iAngularLogGauge.Label2Text;
  ShowLabel2CheckBox.AsBoolean              := iAngularLogGauge.ShowLabel2;
  Label2OffsetXEdit.AsInteger               := iAngularLogGauge.Label2OffsetX;
  Label2OffsetYEdit.AsInteger               := iAngularLogGauge.Label2OffsetY;
  Label2AlignHorizontalRadioGroup.AsInteger := ord(iAngularLogGauge.Label2AlignHorizontal);
  Label2AlignVerticalRadioGroup.AsInteger   := ord(iAngularLogGauge.Label2AlignVertical);

  UpLoadOPCProperties(iAngularLogGauge, iOPCBrowserPanel);

  FPointerManager.Clear;

  for x := 0 to iAngularLogGauge.PointerCount-1 do
    begin
      FPointerManager.Add;
      FPointerManager.Items[x].Visible  := iAngularLogGauge.Pointers[x].Visible;
      FPointerManager.Items[x].Position := iAngularLogGauge.Pointers[x].Position;
      FPointerManager.Items[x].Size     := iAngularLogGauge.Pointers[x].Size;
      FPointerManager.Items[x].Margin   := iAngularLogGauge.Pointers[x].Margin;
      FPointerManager.Items[x].Color    := iAngularLogGauge.Pointers[x].Color;
      FPointerManager.Items[x].Style    := iAngularLogGauge.Pointers[x].Style;
    end;

  TickLabelFontPicker.Font.Assign(iAngularLogGauge.TickLabelFont);
  Label1FontPicker.Font.Assign(iAngularLogGauge.Label1Font);
  Label2FontPicker.Font.Assign(iAngularLogGauge.Label2Font);
  
  if iPointerListBox.Items.Count > FLastPointerIndex then iPointerListBox.ItemIndex := FLastPointerIndex;

  UpdatePointers;
end;
//****************************************************************************************************************************************************
procedure TiAngularLogGaugeComponentEditorForm.CopyPropertiesToComponent(Component: TWinControl);
var
  iAngularLogGauge : TiAngularLogGauge;
  x                : Integer;
begin
  iAngularLogGauge := Component as TiAngularLogGauge;

  //-------------- General ------------------------------------------------------------------------------------------------------------------------
  iAngularLogGauge.PositionMax           := PositionMaxEdit.AsFloat;
  iAngularLogGauge.PositionMin           := PositionMinEdit.AsFloat;
  iAngularLogGauge.CurrentMax            := CurrentMaxEdit.AsFloat;
  iAngularLogGauge.CurrentMin            := CurrentMinEdit.AsFloat;
  iAngularLogGauge.ShowInnerArcRadius    := ShowInnerArcRadiusCheckBox.AsBoolean;
  iAngularLogGauge.ShowOuterArcRadius    := ShowOuterArcRadiusCheckBox.AsBoolean;
  iAngularLogGauge.BackGroundColor       := BackGroundColorPicker.Color;
  iAngularLogGauge.AutoFrameRate         := AutoFrameRateCheckBox.AsBoolean;
  iAngularLogGauge.UpdateFrameRate       := UpdateFrameRateEdit.AsInteger;

  iAngularLogGauge.BorderStyle           := TiBevelStyle(BorderStyleRadioGroup.AsInteger);

  iAngularLogGauge.ArcRadius             := ArcRadiusEdit.AsInteger;
  iAngularLogGauge.ArcRangeDegrees       := ArcRangeDegreesEdit.AsInteger;
  iAngularLogGauge.ArcStartDegrees       := ArcStartDegreesEdit.AsInteger;

  iAngularLogGauge.OffsetX               := OffsetXEdit.AsInteger;
  iAngularLogGauge.OffsetY               := OffsetYEdit.AsInteger;

  iAngularLogGauge.ShowHub               := ShowHubCheckBox.AsBoolean;
  iAngularLogGauge.HubSize               := HubSizeEdit.AsInteger;
  iAngularLogGauge.HubColor              := HubColorPicker.Color;
  iAngularLogGauge.CachedDrawing         := CachedDrawingCheckBox.AsBoolean;
  iAngularLogGauge.Transparent           := TransparentCheckBox.AsBoolean;
  //-------------- Pointers -----------------------------------------------------------------------------------------------------------------------
  iAngularLogGauge.MinMaxPointerSize     := MinMaxPointerSizeEdit.AsInteger;
  iAngularLogGauge.MinMaxPointerMargin   := MinMaxPointerMarginEdit.AsInteger;
  iAngularLogGauge.MinMaxFixed           := MinMaxFixedCheckBox.AsBoolean;
  iAngularLogGauge.MinMaxUserCanMove     := MinMaxUserCanMoveCheckBox.AsBoolean;
  iAngularLogGauge.MinMaxPointerStyle    := TiAngularGaugePointerStyle(MinMaxPointerStyleRadioGroup.AsInteger);

  iAngularLogGauge.ShowMaxPointer        := ShowMaxPointerCheckBox.AsBoolean;
  iAngularLogGauge.MaxPointerColor       := MaxPointerColorPicker.Color;

  iAngularLogGauge.ShowMinPointer        := ShowMinPointerCheckBox.AsBoolean;
  iAngularLogGauge.MinPointerColor       := MinPointerColorPicker.Color;
  //-------------- Ticks --------------------------------------------------------------------------------------------------------------------------
  iAngularLogGauge.TickMargin            := TickMarginEdit.AsInteger;

  iAngularLogGauge.TickLabelPrecision    := TickLabelPrecisionEdit.AsInteger;
  iAngularLogGauge.TickLabelMargin       := TickLabelMarginEdit.AsInteger;
  iAngularLogGauge.TickLabelStyle        := TiLogLabelStyle(TickLabelStyleRadioGroup.AsInteger);

  iAngularLogGauge.TickMajorLength       := TickMajorLengthEdit.AsInteger;
  iAngularLogGauge.TickMajorColor        := TickMajorColorPicker.Color;

  iAngularLogGauge.TickMinorLength       := TickMinorLengthEdit.AsInteger;
  iAngularLogGauge.TickMinorColor        := TickMinorColorPicker.Color;
  iAngularLogGauge.TickMinorAlignment    := TiTickMinorAlignment(TickMinorAlignmentRadioGroup.AsInteger);
  //-------------- Sections -----------------------------------------------------------------------------------------------------------------------
  iAngularLogGauge.SectionCount          := SectionCountEdit.AsInteger;
  iAngularLogGauge.SectionColor1         := SectionColor1Picker.Color;
  iAngularLogGauge.SectionColor2         := SectionColor2Picker.Color;
  iAngularLogGauge.SectionColor3         := SectionColor3Picker.Color;
  iAngularLogGauge.SectionColor4         := SectionColor4Picker.Color;
  iAngularLogGauge.SectionColor5         := SectionColor5Picker.Color;

  iAngularLogGauge.SectionEnd1           := SectionEnd1Edit.AsFloat;
  iAngularLogGauge.SectionEnd2           := SectionEnd2Edit.AsFloat;
  iAngularLogGauge.SectionEnd3           := SectionEnd3Edit.AsFloat;
  iAngularLogGauge.SectionEnd4           := SectionEnd4Edit.AsFloat;
  //-------------- Labels -------------------------------------------------------------------------------------------------------------------------
  iAngularLogGauge.Label1Text            := Label1TextEdit.AsString;
  iAngularLogGauge.ShowLabel1            := ShowLabel1CheckBox.AsBoolean;
  iAngularLogGauge.Label1OffsetX         := Label1OffsetXEdit.AsInteger;
  iAngularLogGauge.Label1OffsetY         := Label1OffsetYEdit.AsInteger;
  iAngularLogGauge.Label1AlignHorizontal := TiAlignmentHorizontal(Label1AlignHorizontalRadioGroup.AsInteger);
  iAngularLogGauge.Label1AlignVertical   := TiAlignmentVertical(Label1AlignVerticalRadioGroup.AsInteger);

  iAngularLogGauge.Label2Text            := Label2TextEdit.AsString;
  iAngularLogGauge.ShowLabel2            := ShowLabel2CheckBox.AsBoolean;
  iAngularLogGauge.Label2OffsetX         := Label2OffsetXEdit.AsInteger;
  iAngularLogGauge.Label2OffsetY         := Label2OffsetYEdit.AsInteger;
  iAngularLogGauge.Label2AlignHorizontal := TiAlignmentHorizontal(Label2AlignHorizontalRadioGroup.AsInteger);
  iAngularLogGauge.Label2AlignVertical   := TiAlignmentVertical(Label2AlignVerticalRadioGroup.AsInteger);

  DownLoadOPCProperties(iAngularLogGauge, iOPCBrowserPanel);

  iAngularLogGauge.RemoveAllPointers;
  for x := 0 to FPointerManager.Count-1 do
    begin
      if x <> 0 then iAngularLogGauge.AddPointer;

      iAngularLogGauge.Pointers[x].Visible  := FPointerManager.Items[x].Visible;
      iAngularLogGauge.Pointers[x].Position := FPointerManager.Items[x].Position;
      iAngularLogGauge.Pointers[x].Size     := FPointerManager.Items[x].Size;
      iAngularLogGauge.Pointers[x].Margin   := FPointerManager.Items[x].Margin;
      iAngularLogGauge.Pointers[x].Color    := FPointerManager.Items[x].Color;
      iAngularLogGauge.Pointers[x].Style    := FPointerManager.Items[x].Style;
    end;

  iAngularLogGauge.TickLabelFont.Assign(TickLabelFontPicker.Font);
  iAngularLogGauge.Label1Font.Assign(Label1FontPicker.Font);
  iAngularLogGauge.Label2Font.Assign(Label2FontPicker.Font);

  FLastPointerIndex := iPointerListBox.ItemIndex;
end;
//****************************************************************************************************************************************************
procedure TiAngularLogGaugeComponentEditorForm.iComponentEditorFormCreate(Sender: TObject);
begin
  FPointerManager := TiGaugePointerManager.Create(ChangeEvent, InsertEvent, RemoveEvent);
  UpdatePointers;
end;
//****************************************************************************************************************************************************
procedure TiAngularLogGaugeComponentEditorForm.iComponentEditorFormDestroy(Sender: TObject);
begin
  FPointerManager.Free;
end;
//****************************************************************************************************************************************************
procedure TiAngularLogGaugeComponentEditorForm.iPointerListBoxClick(Sender: TObject);
begin
  UpdatePointers;
end;
//****************************************************************************************************************************************************
procedure TiAngularLogGaugeComponentEditorForm.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 TiAngularLogGaugeComponentEditorForm.ChangeEvent(Sender: TObject);
begin
end;
//****************************************************************************************************************************************************
procedure TiAngularLogGaugeComponentEditorForm.InsertEvent(Sender: TObject);
begin
  if Sender is TiGaugePointer then (Sender as TiGaugePointer).Position := 1;
  if Sender is TiGaugePointer then  iPointerListBox.Items.AddObject('',Sender);
  iPointerListBox.SelectLast;
end;
//****************************************************************************************************************************************************
procedure TiAngularLogGaugeComponentEditorForm.RemoveEvent(Sender: TObject);
begin
  iPointerListBox.Items.Delete(iPointerListBox.Items.IndexOfObject(Sender));
end;
//****************************************************************************************************************************************************
procedure TiAngularLogGaugeComponentEditorForm.iPointerAddButtonClick(Sender: TObject);
begin
  FPointerManager.Add;
  UpdatePointers;
  Modified := True;
end;
//****************************************************************************************************************************************************
procedure TiAngularLogGaugeComponentEditorForm.PointerRemoveButtonClick(Sender: TObject);
begin
  iPointerListBox.DeleteSelectedObject;
  UpdatePointers;
  Modified := True;
end;
//****************************************************************************************************************************************************
procedure TiAngularLogGaugeComponentEditorForm.PositionEditChange(Sender: TObject);
begin
  FPointerManager.Items[0].Position := PositionEdit.AsFloat;
  UpdatePointers;
end;
//****************************************************************************************************************************************************
procedure TiAngularLogGaugeComponentEditorForm.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 TiAngularLogGaugeComponentEditorForm.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 + -