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

📄 istripchartcomponenteditor.pas

📁 iocopm3.04源码,一套很好的工控开发工具
💻 PAS
📖 第 1 页 / 共 3 页
字号:
    PrinterMarginBottomEdit: TiComponentEditorEdit;
    PrinterMarginRightEdit: TiComponentEditorEdit;
    PrinterOrientationRadioGroup: TiComponentEditorRadioGroup;
    PrinterShowDialogCheckBox: TiComponentEditorCheckBox;
    AboutTabSheet: TTabSheet;
    ThemeTabSheet: TTabSheet;
    iComponentEditorThemePanel: TiComponentEditorThemePanel;
    PrinterCommentLineGroupBox: TGroupBox;
    PrinterCommentLinesFontPicker: TiComponentEditorFontPicker;
    Label48: TLabel;
    PrinterCommentLineSpacingEdit: TiComponentEditorEdit;
    PrinterCommentLineSpacingUpDown: TiUpDown;
    iAboutPanel1: TiAboutPanel;
    Label31: TLabel;
    Label76: TLabel;
    UpdateFrameRateUpDown: TiUpDown;
    BackGroundColorPicker: TiComponentEditorColorPicker;
    UpdateFrameRateEdit: TiComponentEditorEdit;
    AutoFrameRateCheckBox: TiComponentEditorCheckBox;
    procedure iChannelAddButtonClick(Sender: TObject);
    procedure ChannelRemoveButtonClick(Sender: TObject);
    procedure ChannelListBoxClick(Sender: TObject);
    procedure ChannelChange(Sender: TObject);
    procedure iComponentEditorFormDestroy(Sender: TObject);
    procedure ChannelListBoxItemMove(Sender: TObject);
    procedure ChannelListBoxGetData(const Index: Integer; var DrawColorBox: Boolean; var AColor: TColor; var AText: String);
  private
    FLastChannelIndex  : Integer;
    procedure UpdateChannelEdit;
  protected
    procedure CreateThemeInstance; override;
    procedure CopyPropertiesToForm     (Component: TWinControl); override;
    procedure CopyPropertiesToComponent(Component: TWinControl); override;
  public
    procedure ClearList;
  end;

var
  iStripChartComponentEditorForm: TiStripChartComponentEditorForm;

implementation

{$R *.dfm}
//****************************************************************************************************************************************************
procedure TiStripChartComponentEditorForm.CreateThemeInstance;
begin
  iThemeInstance := TiStripChart.Create(Self);
end;
//****************************************************************************************************************************************************
procedure TiStripChartComponentEditorForm.iComponentEditorFormDestroy(Sender: TObject);
begin
  ClearList;
end;
//****************************************************************************************************************************************************
procedure TiStripChartComponentEditorForm.ClearList;
begin
    while ChannelListBox.Items.Count > 0 do
      begin
        ChannelListBox.Items.Objects[0].Free;
        ChannelListBox.Items.Delete(0);
      end;
end;
//****************************************************************************************************************************************************
procedure TiStripChartComponentEditorForm.ChannelListBoxClick(Sender: TObject);
begin
  UpdateChannelEdit;
end;
//****************************************************************************************************************************************************
procedure TiStripChartComponentEditorForm.ChannelListBoxItemMove(Sender: TObject);
begin
  Modified := True;
end;
//****************************************************************************************************************************************************
procedure TiStripChartComponentEditorForm.ChannelListBoxGetData(const Index: Integer; var DrawColorBox: Boolean; var AColor: TColor; var AText: String);
begin
  AColor := (ChannelListBox.Items.Objects[Index] as TiStripChartChannelObject).Color;
  AText  := (ChannelListBox.Items.Objects[Index] as TiStripChartChannelObject).Title;
end;
///****************************************************************************************************************************************************
procedure TiStripChartComponentEditorForm.iChannelAddButtonClick(Sender: TObject);
var
  iChannelObject : TiStripChartChannelObject;
begin
  iChannelObject           := TiStripChartContinuousDataChannelObject.Create;
  iChannelObject.Title     := 'Untitled';
  iChannelObject.LineStyle := iclsSolid;
  iChannelObject.Color     := clRed;
  ChannelListBox.ItemIndex := ChannelListBox.Items.AddObject(iChannelObject.Title, iChannelObject);
  ChannelListBoxClick(Self);

  CursorChannelUpDown.Max  := ChannelListBox.Items.Count -1;
  if StrToInt(CursorChannelEdit.Text) > CursorChannelUpDown.Max then CursorChannelEdit.Text := IntToStr(CursorChannelUpDown.Max);

  Modified := True;
end;
//****************************************************************************************************************************************************
procedure TiStripChartComponentEditorForm.ChannelRemoveButtonClick(Sender: TObject);
var
  LastIndex : Integer;
begin
  LastIndex := ChannelListBox.ItemIndex;
  ChannelListBox.Items.Objects[ChannelListBox.ItemIndex].Free;
  ChannelListBox.Items.Delete(ChannelListBox.ItemIndex);
  if ChannelListBox.Items.Count <> 0 then
    begin
      if LastIndex > (ChannelListBox.Items.Count - 1) then ChannelListBox.ItemIndex := LastIndex - 1
        else ChannelListBox.ItemIndex := LastIndex;
    end;

  CursorChannelUpDown.Max  := ChannelListBox.Items.Count -1;
  if StrToInt(CursorChannelEdit.Text) > CursorChannelUpDown.Max then CursorChannelEdit.Text := IntToStr(CursorChannelUpDown.Max);

  UpdateChannelEdit;
  Modified := True;
end;
//****************************************************************************************************************************************************
procedure TiStripChartComponentEditorForm.UpdateChannelEdit;
var
  iChannelObject : TiStripChartChannelObject;
begin
  if ChannelListBox.ItemIndex = - 1 then DisableAllEditControlsStartingWith('Channel')
    else
      begin
        EnableAllEditControlsStartingWith('Channel');

        iChannelObject := ChannelListBox.Items.Objects[ChannelListBox.ItemIndex] as TiStripChartChannelObject;

        ChannelTitleEdit.AsString          := iChannelObject.Title;
        ChannelColorPicker.Color           := iChannelObject.Color;
        ChannelLineStyleComboBox.AsInteger := ord(iChannelObject.LineStyle);
        ChannelLineWidthEdit.AsInteger     := iChannelObject.LineWidth;
    end
end;
//****************************************************************************************************************************************************
procedure TiStripChartComponentEditorForm.ChannelChange(Sender: TObject);
var
  iChannelObject : TiStripChartChannelObject;
begin
  if ChannelListBox.ItemIndex = -1 then exit;

  iChannelObject := ChannelListBox.Items.Objects[ChannelListBox.ItemIndex] as TiStripChartChannelObject;

  iChannelObject.Title     := ChannelTitleEdit.AsString;
  iChannelObject.LineStyle := TiChannelLineStyle(ChannelLineStyleComboBox.AsInteger);
  iChannelObject.LineWidth := ChannelLineWidthEdit.AsInteger;
  iChannelObject.Color     := ChannelColorPicker.Color;

  ChannelListBox.Invalidate;
  UpdateChannelEdit;
end;
//****************************************************************************************************************************************************
procedure TiStripChartComponentEditorForm.CopyPropertiesToForm(Component: TWinControl);
var
  iStripChart    : TiStripChart;
  iChannelObject : TiStripChartChannelObject;
  x              : Integer;
begin
  iStripChart := Component as TiStripChart;

  ClearList;
  for x := 0 to iStripChart.ChannelCount - 1 do
    begin
      iChannelObject           := TiStripChartContinuousDataChannelObject.Create;
      iChannelObject.Title     := iStripChart.ChannelTitle[x];
      iChannelObject.LineStyle := iStripChart.ChannelLineStyle[x];
      iChannelObject.LineWidth := iStripChart.ChannelLineWidth[x];
      iChannelObject.Color     := iStripChart.ChannelColor[x];
      ChannelListBox.Items.AddObject(iChannelObject.Title, iChannelObject);
    end;

  if ChannelListBox.Items.Count <> 0 then ChannelListBox.ItemIndex := 0;
  CursorChannelUpDown.Max  := ChannelListBox.Items.Count -1;
  //--------- General --------------------------------------------------------------------------------------------------------------------------------
  BackGroundColorPicker.Color                    := iStripChart.BackGroundColor;

  MaxBufferSizeEdit.AsInteger                    := iStripChart.MaxBufferSize;
  MinBufferSizeEdit.AsInteger                    := iStripChart.MinBufferSize;

  TitleEdit.AsString                             := iStripChart.TitleText;
  TitleMarginEdit.AsInteger                      := iStripChart.TitleMargin;

  EnableDataDrawMinMaxCheckBox.AsBoolean         := iStripChart.EnableDataDrawMinMax;
  DiscontinuousDataEnabledCheckBox.AsBoolean     := iStripChart.DiscontinuousDataEnabled;
  InterpolateMissingDataPointsCheckBox.AsBoolean := iStripChart.InterpolateMissingDataPoints;
  AutoFrameRateCheckBox.AsBoolean                := iStripChart.AutoFrameRate;
  UpdateFrameRateEdit.AsInteger                  := iStripChart.UpdateFrameRate;

  BorderStyleRadioGroup.AsInteger                := ord(iStripChart.BorderStyle);
  PrecisionStyleRadioGroup.AsInteger             := ord(iStripChart.PrecisionStyle);

  OuterMarginLeftEdit.AsInteger                  := iStripChart.OuterMarginLeft;
  OuterMarginTopEdit.AsInteger                   := iStripChart.OuterMarginTop;
  OuterMarginRightEdit.AsInteger                 := iStripChart.OuterMarginRight;
  OuterMarginBottomEdit.AsInteger                := iStripChart.OuterMarginBottom;
  //--------- AutoScroll/Scale -----------------------------------------------------------------------------------------------------------------------
  AutoScaleCheckBox.AsBoolean                    := iStripChart.AutoScaleEnabled;
  AutoScaleMaxAdjustEnabledCheckBox.AsBoolean    := iStripChart.AutoScaleMaxAdjustEnabled;
  AutoScaleMinAdjustEnabledCheckBox.AsBoolean    := iStripChart.AutoScaleMinAdjustEnabled;
  AutoScaleHysterisisEdit.AsFloat                := iStripChart.AutoScaleHysterisis;

  AutoScrollEnabledCheckBox.AsBoolean            := iStripChart.AutoScrollEnabled;
  AutoScrollTypeRadioGroup.AsInteger             := ord(iStripChart.AutoScrollType);
  AutoScrollStepSizeEdit.AsFloat                 := iStripChart.AutoScrollStepSize;
  AutoScrollFirstStyleRadioGroup.AsInteger       := ord(iStripChart.AutoScrollFirstStyle);
  //------------ XAxis -------------------------------------------------------------------------------------------------------------------------------
  XAxisMaxEdit.AsFloat                           := iStripChart.XAxisMax;
  XAxisMinEdit.AsFloat                           := iStripChart.XAxisMin;
  XAxisMarginEdit.AsInteger                      := iStripChart.XAxisMargin;
  XAxisShowCheckBox.AsBoolean                    := iStripChart.XAxisShow;

  XAxisTitleEdit.AsString                        := iStripChart.XAxisTitle;
  XAxisTitleMarginEdit.AsInteger                 := iStripChart.XAxisTitleMargin;

  XAxisTickMajorColorPicker.Color                := iStripChart.XAxisTickMajorColor;

⌨️ 快捷键说明

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