修正TiKnob的指示箭头显示问题

编程入门 行业动态 更新时间:2024-10-25 06:30:27

修正TiKnob的指示<a href=https://www.elefans.com/category/jswz/34/1769663.html style=箭头显示问题"/>

修正TiKnob的指示箭头显示问题

iocom官方只支持到D7,但是可以运用于新版本,只测试过显示运用,没测试过OPC特性(这个在新版本运用中估计有问题)。

但是在新版本运用中还有有一些小BUG,比如:

修正TiAnlogDisplay显示的问题-CSDN博客

TiKnob也发现BUG。

在10.4中拖入一个TiKnob,发现“Indicator”没有显示出来,

修改 

procedure TiKnob.DrawIndicator(Canvas: TCanvas; const CenterPoint: TPoint);
varInnerPoint           : TPoint;OuterPoint           : TPoint;IndicatorCenterPoint : Tpoint;IndicatorRect        : TRect;IndicatorDegrees     : Double;PointerEndPoint      : TPoint;PointerBasePoint     : TPoint;Point1               : TPoint;Point2               : Tpoint;
beginIndicatorDegrees := RotationStartDegrees - PositionDegrees;//with Canvas, IndicatorRect dowith Canvas dobeginBrush.Style := bsSolid;IndicatorCenterPoint := GetXYRadPoint(IndicatorDegrees, FKnobRadius - FIndicatorMargin - FIndicatorSize, CenterPoint);IndicatorRect := Rect(IndicatorCenterPoint.x - FIndicatorSize,IndicatorCenterPoint.y - FIndicatorSize,IndicatorCenterPoint.x + FIndicatorSize,IndicatorCenterPoint.y + FIndicatorSize);if FMouseDown or FKeyDown then begin Pen.Color := FIndicatorActiveColor;   Brush.Color := FIndicatorActiveColor    endelse                           begin Pen.Color := FIndicatorInactiveColor; Brush.Color := FIndicatorInactiveColor; end;case FIndicatorStyle ofikisDotLowered : beginEllipse(IndicatorRect.Left, IndicatorRect.Top, IndicatorRect.Right, IndicatorRect.Bottom);Pen.Color := clGray;  Arc(IndicatorRect.Left, IndicatorRect.Top, IndicatorRect.Right, IndicatorRect.Bottom, IndicatorRect.Right, IndicatorRect.Top, IndicatorRect.Left, IndicatorRect.Bottom);Pen.Color := clWhite; Arc(IndicatorRect.Left, IndicatorRect.Top, IndicatorRect.Right, IndicatorRect.Bottom, IndicatorRect.Left , IndicatorRect.Bottom, IndicatorRect.Right, IndicatorRect.Top);end;ikisDotRaised  : beginEllipse(IndicatorRect.Left, IndicatorRect.Top, IndicatorRect.Right, IndicatorRect.Bottom);Pen.Color := clWhite; Arc(IndicatorRect.Left, IndicatorRect.Top, IndicatorRect.Right, IndicatorRect.Bottom, IndicatorRect.Right, IndicatorRect.Top, IndicatorRect.Left, IndicatorRect.Bottom);Pen.Color := clGray;  Arc(IndicatorRect.Left, IndicatorRect.Top, IndicatorRect.Right, IndicatorRect.Bottom, IndicatorRect.Left, IndicatorRect.Bottom, IndicatorRect.Right, IndicatorRect.Top);end;ikisDot        : beginEllipse(IndicatorRect.Left, IndicatorRect.Top, IndicatorRect.Right, IndicatorRect.Bottom);end;ikisLineCenter : beginOuterPoint:=GetXYRadPoint(IndicatorDegrees,FKnobRadius-FIndicatorMargin,CenterPoint);PolyLine([OuterPoint, CenterPoint]);end;ikisLineCustom : beginOuterPoint:=GetXYRadPoint(IndicatorDegrees,FKnobRadius-FIndicatorMargin,               CenterPoint);InnerPoint:=GetXYRadPoint(IndicatorDegrees,FKnobRadius-FIndicatorMargin-FIndicatorSize,CenterPoint);PolyLine([OuterPoint, InnerPoint]);end;ikisTriangle   : beginPointerEndPoint :=GetXYRadPoint(IndicatorDegrees,FKnobRadius-FIndicatorMargin,               CenterPoint);PointerBasePoint:=GetXYRadPoint(IndicatorDegrees,FKnobRadius-FIndicatorMargin-FIndicatorSize,CenterPoint);Point1 := GetXYRadPoint(IndicatorDegrees + 90, FIndicatorSize/2, PointerBasePoint);Point2 := GetXYRadPoint(IndicatorDegrees - 90, FIndicatorSize/2, PointerBasePoint);Polygon([Point1, Point2, PointerEndPoint]);end;end;end;
end;

是由于Canvas和IndicatorRect都有Left和Top属性引起的。

重新编译(不用重新安装),正常 。

估计其它控件也有类似的问题,一般照此修改就可以。

更多推荐

修正TiKnob的指示箭头显示问题

本文发布于:2023-11-15 18:31:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1604224.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:箭头   指示   TiKnob

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!