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

📄 iswitchrotarycomponenteditor.pas

📁 iocopm3.04源码,一套很好的工控开发工具
💻 PAS
字号:
{*******************************************************}
{                                                       }
{       TiSwitchRotaryComponentEditor                   }
{                                                       }
{       Copyright (c) 1997,2003 Iocomp Software         }
{                                                       }
{*******************************************************}
{$I iInclude.inc}

{$ifdef iVCL}unit  iSwitchRotaryComponentEditor;{$endif}
{$ifdef iCLX}unit QiSwitchRotaryComponentEditor;{$endif}

interface

uses
  {$I iIncludeUsesForms.inc}

  {$IFDEF iVCL} iComponentEditorForm,  iTypes,  iSwitchRotary,{$ENDIF}
  {$IFDEF iCLX}QiComponentEditorForm, QiTypes, QiSwitchRotary,{$ENDIF}

  {$IFDEF iVCL}  StdCtrls,  ExtCtrls,  Controls,  ComCtrls, Classes,  iComponentEditorThemePanel,  iComponentEditorButtonPanel,  iEditorBasicComponents,  iOPCBrowserPanel,  iAboutPanel,
  iRadioGroup, iComponent, iVCLComponent, iCustomComponent, iCheckBox;{$ENDIF}
  {$IFDEF iCLX} QStdCtrls, QExtCtrls, QControls, QComCtrls, Classes, QiComponentEditorThemePanel, QiComponentEditorButtonPanel, QiEditorBasicComponents, QiOPCBrowserPanel, QiAboutPanel;{$ENDIF}

type
  TiSwitchRotaryComponentEditorForm = class(TiComponentEditorForm)
    PageControl: TiComponentEditorPageControl;
    GeneralTabSheet: TTabSheet;
    EnabledCheckBox: TiComponentEditorCheckBox;
    ShowFocusRectCheckBox: TiComponentEditorCheckBox;
    Label12: TLabel;
    PositionEdit: TiComponentEditorEdit;
    PositionUpDown: TiUpDown;
    KeyStepSizeGroupBox: TGroupBox;
    Label5: TLabel;
    Label7: TLabel;
    KeyArrowStepSizeEdit: TiComponentEditorEdit;
    KeyArrowStepSizeUpDown: TiUpDown;
    KeyPageStepSizeEdit: TiComponentEditorEdit;
    KeyPageStepSizeUpDown: TiUpDown;
    TransparentCheckBox: TiComponentEditorCheckBox;
    AboutTabSheet: TTabSheet;
    iComponentEditorButtonPanel1: TiComponentEditorButtonPanel;
    ThemeTabSheet: TTabSheet;
    iComponentEditorThemePanel: TiComponentEditorThemePanel;
    OPCTabSheet: TTabSheet;
    iOPCBrowserPanel: TiOPCBrowserPanel;
    iAboutPanel1: TiAboutPanel;
    Label76: TLabel;
    UpdateFrameRateUpDown: TiUpDown;
    UpdateFrameRateEdit: TiComponentEditorEdit;
    AutoFrameRateCheckBox: TiComponentEditorCheckBox;
    DesignTabSheet: TTabSheet;
    iComponentEditorPageControl1: TiComponentEditorPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    DesignPointerTabSheet: TTabSheet;
    PositionLabelsGroupBox: TGroupBox;
    Label6: TLabel;
    Label13: TLabel;
    PositionLabelMarginUpDown: TiUpDown;
    PositionLabelMarginEdit: TiComponentEditorEdit;
    PositionLabelActiveFontPicker: TiComponentEditorFontPicker;
    PositionLabelInactiveFontPicker: TiComponentEditorFontPicker;
    PositionLabelAlignmentRadioGroup: TiComponentEditorRadioGroup;
    PositionLabelsListBox: TiComponentEditorMemo;
    ShowPositionLabelsCheckBox: TiComponentEditorCheckBox;
    PositionIndicatorGroupBox: TGroupBox;
    Label2: TLabel;
    Label4: TLabel;
    Label11: TLabel;
    PositionIndicatorSizeUpDown: TiUpDown;
    PositionIndicatorMarginUpDown: TiUpDown;
    PositionIndicatorColorPicker: TiComponentEditorColorPicker;
    PositionIndicatorBevelStyleRadioGroup: TiComponentEditorRadioGroup;
    PositionIndicatorSizeEdit: TiComponentEditorEdit;
    PositionIndicatorMarginEdit: TiComponentEditorEdit;
    ShowPositionIndicatorsCheckBox: TiComponentEditorCheckBox;
    Label31: TLabel;
    BackGroundColorPicker: TiComponentEditorColorPicker;
    RotationStartDegreesRadioGroup: TiComponentEditorRadioGroup;
    OffsetGroupBox: TGroupBox;
    Label9: TLabel;
    Label10: TLabel;
    OffsetXUpDown: TiUpDown;
    OffsetYUpDown: TiUpDown;
    OffsetXEdit: TiComponentEditorEdit;
    OffsetYEdit: TiComponentEditorEdit;
    MouseControlStyleRadioGroup: TiComponentEditorRadioGroup;
    Label1: TLabel;
    Label8: TLabel;
    PointerHeightUpDown: TiUpDown;
    PointerLengthUpDown: TiUpDown;
    Label14: TLabel;
    PointerHeightEdit: TiComponentEditorEdit;
    PointerLengthEdit: TiComponentEditorEdit;
    PointerStyleComboBox: TiComponentEditorComboBox;
    Label3: TLabel;
    PointerColorPicker: TiComponentEditorColorPicker;
    Label15: TLabel;
    PointerHighlightColorPicker: TiComponentEditorColorPicker;
    RotationDesiredSpacingRadioGroup: TiComponentEditorRadioGroup;
  protected
    procedure CreateThemeInstance; override;
    procedure CopyPropertiesToForm     (Component: TWinControl); override;
    procedure CopyPropertiesToComponent(Component: TWinControl); override;
  end;

var
  iSwitchRotaryComponentEditorForm: TiSwitchRotaryComponentEditorForm;

implementation

{$R *.dfm}
//****************************************************************************************************************************************************
procedure TiSwitchRotaryComponentEditorForm.CreateThemeInstance;
begin
  iThemeInstance := TiSwitchRotary.Create(Self);
end;
//****************************************************************************************************************************************************
procedure TiSwitchRotaryComponentEditorForm.CopyPropertiesToForm(Component: TWinControl);
var
  iSwitchRotary : TiSwitchRotary;
  x             : Integer;
begin
  iSwitchRotary := Component as TiSwitchRotary;

  PositionEdit.AsInteger                          := iSwitchRotary.Position;
  ShowFocusRectCheckBox.AsBoolean                 := iSwitchRotary.ShowFocusRect;
  EnabledCheckBox.AsBoolean                       := iSwitchRotary.Enabled;
  TransparentCheckBox.AsBoolean                   := iSwitchRotary.Transparent;
  AutoFrameRateCheckBox.AsBoolean                 := iSwitchRotary.AutoFrameRate;
  UpdateFrameRateEdit.AsInteger                   := iSwitchRotary.UpdateFrameRate;

  KeyArrowStepSizeEdit.AsInteger                  := iSwitchRotary.KeyArrowStepSize;
  KeyPageStepSizeEdit.AsInteger                   := iSwitchRotary.KeyPageStepSize;

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

  BackGroundColorPicker.Color                     := iSwitchRotary.BackGroundColor;

  RotationStartDegreesRadioGroup.AsInteger        := ord(iSwitchRotary.RotationStartDegrees);
  RotationDesiredSpacingRadioGroup.AsInteger      := ord(iSwitchRotary.RotationDesiredSpacing);
  MouseControlStyleRadioGroup.AsInteger           := ord(iSwitchRotary.MouseControlStyle);

  PointerHeightEdit.AsInteger                     := iSwitchRotary.PointerHeight;
  PointerLengthEdit.AsInteger                     := iSwitchRotary.PointerLength;
  PointerStyleComboBox.AsInteger                  := ord(iSwitchRotary.PointerStyle);
  PointerColorPicker.Color                        := iSwitchRotary.PointerColor;
  PointerHighlightColorPicker.Color               := iSwitchRotary.PointerHighLightColor;

  ShowPositionLabelsCheckBox.AsBoolean            := iSwitchRotary.ShowPositionLabels;
  PositionLabelAlignmentRadioGroup.AsInteger      := ord(iSwitchRotary.PositionLabelAlignment);
  PositionLabelMarginEdit.AsInteger               := iSwitchRotary.PositionLabelMargin;

  PositionLabelsListBox.Lines.Clear;
  for x := 0 to iSwitchRotary.PositionLabelCount - 1 do
    PositionLabelsListBox.Lines.Add(iSwitchRotary.PositionLabel[x]);

  PositionIndicatorBevelStyleRadioGroup.AsInteger := ord(iSwitchRotary.PositionIndicatorBevelStyle);
  ShowPositionIndicatorsCheckBox.AsBoolean        := iSwitchRotary.ShowPositionIndicators;
  PositionIndicatorColorPicker.Color              := iSwitchRotary.PositionIndicatorColor;
  PositionIndicatorSizeEdit.AsInteger             := iSwitchRotary.PositionIndicatorSize;
  PositionIndicatorMarginEdit.AsInteger           := iSwitchRotary.PositionIndicatorMargin;

  UpLoadOPCProperties(iSwitchRotary, iOPCBrowserPanel);

  PositionLabelActiveFontPicker.Font.Assign  (iSwitchRotary.PositionLabelActiveFont);
  PositionLabelInactiveFontPicker.Font.Assign(iSwitchRotary.PositionLabelInactiveFont);
end;
//****************************************************************************************************************************************************
procedure TiSwitchRotaryComponentEditorForm.CopyPropertiesToComponent(Component: TWinControl);
var
  iSwitchRotary : TiSwitchRotary;
  x             : Integer;
  TempString    : String;
begin
  iSwitchRotary := Component as TiSwitchRotary;

  iSwitchRotary.ShowFocusRect               := ShowFocusRectCheckBox.AsBoolean;
  iSwitchRotary.Enabled                     := EnabledCheckBox.AsBoolean;
  iSwitchRotary.Transparent                 := TransparentCheckBox.AsBoolean;
  iSwitchRotary.AutoFrameRate               := AutoFrameRateCheckBox.AsBoolean;
  iSwitchRotary.UpdateFrameRate             := UpdateFrameRateEdit.AsInteger;

  iSwitchRotary.KeyArrowStepSize            := KeyArrowStepSizeEdit.AsInteger;
  iSwitchRotary.KeyPageStepSize             := KeyPageStepSizeEdit.AsInteger;

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

  iSwitchRotary.BackGroundColor             := BackGroundColorPicker.Color;

  iSwitchRotary.RotationStartDegrees        := TiRotaryStartDegrees(RotationStartDegreesRadioGroup.AsInteger);
  iSwitchRotary.RotationDesiredSpacing      := TiRotaryDesiredSpacing(RotationDesiredSpacingRadioGroup.AsInteger);
  iSwitchRotary.MouseControlStyle           := TiRotaryMouseControlStyle(MouseControlStyleRadioGroup.AsInteger);

  iSwitchRotary.PointerHeight               := PointerHeightEdit.AsInteger;
  iSwitchRotary.PointerLength               := PointerLengthEdit.AsInteger;
  iSwitchRotary.PointerStyle                := TiSwitchRotaryPointerStyle(PointerStyleComboBox.AsInteger);
  iSwitchRotary.PointerColor                := PointerColorPicker.Color;
  iSwitchRotary.PointerHighLightColor       := PointerHighlightColorPicker.Color;

  iSwitchRotary.ShowPositionLabels          := ShowPositionLabelsCheckBox.AsBoolean;
  iSwitchRotary.PositionLabelAlignment      := TiLabelAlignment(PositionLabelAlignmentRadioGroup.AsInteger);
  iSwitchRotary.PositionLabelMargin         := PositionLabelMarginEdit.AsInteger;

  TempString := '';
  for x := 0 to PositionLabelsListBox.Lines.Count - 1 do
    begin
      if Trim(PositionLabelsListBox.Lines.Strings[x]) <> '' then
        begin
          if x <> 0 then TempString := TempString + ', ';
          TempString := TempString + PositionLabelsListBox.Lines.Strings[x];
        end;
    end;
  iSwitchRotary.PositionLabels              := TempString;

  iSwitchRotary.Position                    := PositionEdit.AsInteger ; //Must be set after position labels

  iSwitchRotary.PositionIndicatorBevelStyle := TiBevelStyle(PositionIndicatorBevelStyleRadioGroup.AsInteger);
  iSwitchRotary.ShowPositionIndicators      := ShowPositionIndicatorsCheckBox.AsBoolean;
  iSwitchRotary.PositionIndicatorColor      := PositionIndicatorColorPicker.Color;
  iSwitchRotary.PositionIndicatorSize       := PositionIndicatorSizeEdit.AsInteger;
  iSwitchRotary.PositionIndicatorMargin     := PositionIndicatorMarginEdit.AsInteger;

  DownLoadOPCProperties(iSwitchRotary, iOPCBrowserPanel);

  iSwitchRotary.PositionLabelActiveFont.Assign  (PositionLabelActiveFontPicker.Font);
  iSwitchRotary.PositionLabelInactiveFont.Assign(PositionLabelInactiveFontPicker.Font);
end;
//****************************************************************************************************************************************************
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -