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

📄 iplotannotation.pas

📁 iocopm3.04源码,一套很好的工控开发工具
💻 PAS
📖 第 1 页 / 共 5 页
字号:
end;
//****************************************************************************************************************************************************
procedure TiPlotAnnotation.NotificationRename(Sender: TObject);
begin
  if Sender = FChannel then FChannelName := (Sender as TiPlotObject).Name;
end;
//****************************************************************************************************************************************************
procedure TiPlotAnnotation.SetChannelName(const Value: String);
begin
  if FChannelName <> Value then
    begin
      FChannelName := Value;
      FChannel     := nil;
      TriggerChange(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAnnotation.SetFont(const Value: TFont);begin FFont.Assign(Value);end;
//****************************************************************************************************************************************************
procedure TiPlotAnnotation.SetBrushColor    (const Value: TColor );begin SetColorProperty  (Value,FBrushColor,    TriggerChange);end;
procedure TiPlotAnnotation.SetPenColor      (const Value: TColor );begin SetColorProperty  (Value,FPenColor,      TriggerChange);end;
procedure TiPlotAnnotation.SetPenWidth      (const Value: Integer);begin SetIntegerProperty(Value,FPenWidth,      TriggerChange);end;
procedure TiPlotAnnotation.SetText          (const Value: String );begin SetStringProperty (Value,FText,          TriggerChange);end;
procedure TiPlotAnnotation.SetUserCanMove   (const Value: Boolean);begin SetBooleanProperty(Value,FUserCanMove,   nil          );end;
procedure TiPlotAnnotation.SetUserCanSize   (const Value: Boolean);begin SetBooleanProperty(Value,FUserCanSize,   nil          );end;
procedure TiPlotAnnotation.SetClipToAxes    (const Value: Boolean);begin SetBooleanProperty(Value,FClipToAxes,    TriggerChange);end;
procedure TiPlotAnnotation.SetImageIndex    (const Value: Integer);begin SetIntegerProperty(Value,FImageIndex,    TriggerChange);end;
procedure TiPlotAnnotation.SetImageListIndex(const Value: Integer);begin SetIntegerProperty(Value,FImageListIndex,TriggerChange);end;
procedure TiPlotAnnotation.SetTextHorzMargin(const Value: Double );begin SetDoubleProperty (Value,FTextHorzMargin,TriggerChange);end;
procedure TiPlotAnnotation.SetTextVertMargin(const Value: Double );begin SetDoubleProperty (Value,FTextVertMargin,TriggerChange);end;
procedure TiPlotAnnotation.SetShowFocusRect (const Value: Boolean);begin SetBooleanProperty(Value,FShowFocusRect, TriggerChange);end;
procedure TiPlotAnnotation.SetOuterMargin   (const Value: Integer);begin SetIntegerProperty(Value,FOuterMargin,   TriggerChange);end;
//****************************************************************************************************************************************************
procedure TiPlotAnnotation.SetTextHorzAlignment(const Value: TiAlignmentHorizontal);
begin
  if FTextHorzAlignment <> Value then
    begin
      FTextHorzAlignment := Value;
      TriggerChange(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAnnotation.SetTextVertAlignment(const Value: TiAlignmentVertical);
begin
  if FTextVertAlignment <> Value then
    begin
      FTextVertAlignment := Value;
      TriggerChange(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAnnotation.SetWidth(const Value: Double );
begin
  if FWidth <> Value then
    begin
      FWidth := Value;
      TriggerChange(Self);
      TiPlotComponentAccess(Owner).DoAnnotationCoordinatesChange(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAnnotation.SetHeight(const Value: Double );
begin
  if FHeight <> Value then
    begin
      FHeight := Value;
      TriggerChange(Self);
      TiPlotComponentAccess(Owner).DoAnnotationCoordinatesChange(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAnnotation.SetX(const Value: Double );
begin
  if FX <> Value then
    begin
      FX := Value;
      TriggerChange(Self);
      TiPlotComponentAccess(Owner).DoAnnotationCoordinatesChange(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAnnotation.SetY(const Value: Double );
begin
  if FY <> Value then
    begin
      FY := Value;
      TriggerChange(Self);
      TiPlotComponentAccess(Owner).DoAnnotationCoordinatesChange(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAnnotation.SetX2(const Value: Double );
begin
  if FX2 <> Value then
    begin
      FX2 := Value;
      TriggerChange(Self);
      TiPlotComponentAccess(Owner).DoAnnotationCoordinatesChange(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAnnotation.SetY2(const Value: Double );
begin
  if FY2 <> Value then
    begin
      FY2 := Value;
      TriggerChange(Self);
      TiPlotComponentAccess(Owner).DoAnnotationCoordinatesChange(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAnnotation.SetStyle(const Value: TiPlotAnnotationStyle);
begin
  if FStyle <> Value then
    begin
      FStyle := Value;
      TriggerChange(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAnnotation.SetReference(const Value: TiPlotReferenceType);
begin
if FReference <> Value then
  begin
    FReference := Value;
    TriggerChange(Self);
  end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAnnotation.SetPenStyle(const Value: TPenStyle);
begin
  if FPenStyle <> Value then
    begin
      FPenStyle := Value;
     TriggerChange(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAnnotation.SetBrushStyle(const Value: TBrushStyle);
begin
  if FBrushStyle <> Value then
    begin
      FBrushStyle := Value;
      TriggerChange(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAnnotation.SetTextRotation(const Value: TiRotationAngle);
begin
  if FTextRotation <> Value then
    begin
      FTextRotation := Value;
      TriggerChange(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotAnnotation.Draw(const Canvas: TCanvas; const BackGroundColor: TColor);
var
  PixelsX      : Integer;
  PixelsY      : Integer;
  PixelsX2     : Integer;
  PixelsY2     : Integer;

  ARect        : TRect;
  ATextRect    : TRect;
  ATextFlags   : TiTextFlags;
  APoint1      : TPoint;
  APoint2      : TPoint;
  ATemp        : Integer;
  DummyRect    : TRect;
  XAxis        : TiPlotXAxis;
  YAxis        : TiPlotYAxis;
  NeedToClip   : Boolean;

  ImageList    : TImageList;
  AWidth       : Integer;
  AHeight      : Integer;
begin
  FShowing := False;
  if not Visible then Exit;

  XAxis := nil;
  YAxis := nil;

  case FReference of
    iprtDataView          : if not Assigned(FDataView) then Exit;
    iprtChannel           : begin
                              if not Assigned(Channel)                                  then Exit;
                              if not Assigned(TiPlotChannelCustomAccess(Channel).XAxis) then Exit;
                              if not Assigned(TiPlotChannelCustomAccess(Channel).YAxis) then Exit;
                              XAxis := TiPlotChannelCustomAccess(Channel).XAxis;
                              YAxis := TiPlotChannelCustomAccess(Channel).YAxis;
                            end;
    iprtXChannelYDataView : begin
                              if not Assigned(FDataView) then Exit;
                              if not Assigned(Channel)                                  then Exit;
                              if not Assigned(TiPlotChannelCustomAccess(Channel).XAxis) then Exit;
                              if not Assigned(TiPlotChannelCustomAccess(Channel).YAxis) then Exit;
                              XAxis := TiPlotChannelCustomAccess(Channel).XAxis;
                            end;
    iprtXDataViewYChannel : begin
                              if not Assigned(FDataView) then Exit;
                              if not Assigned(Channel)                                  then Exit;
                              if not Assigned(TiPlotChannelCustomAccess(Channel).XAxis) then Exit;
                              if not Assigned(TiPlotChannelCustomAccess(Channel).YAxis) then Exit;
                              YAxis := TiPlotChannelCustomAccess(Channel).YAxis;
                            end;
  end;

                                                                                                NeedToClip := FClipToAxes;
  if (FReference = iprtChannel) then if TiPlotComponentAccess(Owner).ClipAnnotationsToAxes then NeedToClip := True;

  if NeedToClip then
    begin
      if XYAxesReversed then ARect := iRect(YAxis.MinPixels, XAxis.MinPixels, YAxis.MaxPixels, XAxis.MaxPixels)
      else                   ARect := iRect(XAxis.MinPixels, YAxis.MinPixels, XAxis.MaxPixels, YAxis.MaxPixels);
      {$IFDEF iVCL}
      IntersectClipRect(Canvas.Handle, ARect.Left, ARect.Top, ARect.Right, ARect.Bottom);
      {$ENDIF}
    end;

  with Canvas do
    begin
      PixelsX := PositionXToPixels(X);
      PixelsY := PositionYToPixels(Y);

      case Style of
        ipasText          : begin
                              Font.Assign(Self.Font);
                              Brush.Style := bsClear;
                              ATextRect   := iXYReverseRect(XYAxesReversed,PixelsX, PixelsY, PixelsX, PixelsY);

                              AWidth := iTextWidth(Canvas, FText);
                              ARect := Rect(0,0, AWidth, 0);
                              AHeight := iDrawText(Canvas, FText, ARect, [itfCalcRect, itfWordBreak]);

                              FShowing    := True;
                              if FTextRotation <> ira000 then
                                begin
                                  FClickRect  := iDrawRotatedText(Canvas, Text, ATextRect, FTextRotation);
                                  IntersectRect(FClickRect, FClickRect, FDataView.DrawRect);
                                end
                              else

⌨️ 快捷键说明

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