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

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

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

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

TiKnob也发现BUG。

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

修改

Delphi 复制代码
procedure TiKnob.DrawIndicator(Canvas: TCanvas; const CenterPoint: TPoint);
var
  InnerPoint           : TPoint;
  OuterPoint           : TPoint;
  IndicatorCenterPoint : Tpoint;
  IndicatorRect        : TRect;
  IndicatorDegrees     : Double;
  PointerEndPoint      : TPoint;
  PointerBasePoint     : TPoint;
  Point1               : TPoint;
  Point2               : Tpoint;
begin
  IndicatorDegrees := RotationStartDegrees - PositionDegrees;

  //with Canvas, IndicatorRect do
  with Canvas do
    begin
      Brush.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    end
      else                           begin Pen.Color := FIndicatorInactiveColor; Brush.Color := FIndicatorInactiveColor; end;

      case FIndicatorStyle of
        ikisDotLowered : begin
                           Ellipse(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  : begin
                           Ellipse(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        : begin
                           Ellipse(IndicatorRect.Left, IndicatorRect.Top, IndicatorRect.Right, IndicatorRect.Bottom);
                         end;
        ikisLineCenter : begin
                           OuterPoint:=GetXYRadPoint(IndicatorDegrees,FKnobRadius-FIndicatorMargin,CenterPoint);
                           PolyLine([OuterPoint, CenterPoint]);
                         end;
        ikisLineCustom : begin
                           OuterPoint:=GetXYRadPoint(IndicatorDegrees,FKnobRadius-FIndicatorMargin,               CenterPoint);
                           InnerPoint:=GetXYRadPoint(IndicatorDegrees,FKnobRadius-FIndicatorMargin-FIndicatorSize,CenterPoint);
                           PolyLine([OuterPoint, InnerPoint]);
                         end;
        ikisTriangle   : begin
                           PointerEndPoint :=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属性引起的。

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

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

相关推荐
ljklxlj8 天前
rdian是一个结构体,pdian=^Rdian,list泛型做什么用?
delphi
ljklxlj2 个月前
我的杂记一
delphi
月巴月巴白勺合鸟月半2 个月前
以前很常见的一种HTTP操作方式
网络·c++·网络协议·http·delphi
月巴月巴白勺合鸟月半2 个月前
一个小工具
windows·delphi
martian61252 个月前
Delphi Android WebBrowser 加载自定义scheme报错net::ERR_UNKNOWN_URL_SCHEME
delphi
_1_73 个月前
unigui 登陆界面
delphi·unigui
sensor_WU3 个月前
【delphi】常用语言特性:接口、匿名方法、泛型
delphi·delphi 语言特性·delphi 匿名方法·delphi 接口
ufo20064 个月前
fastreport导出PDF后style bold粗体斜体等字体风格不显示的原因
pdf·delphi·fastreport
pcplayer5 个月前
WEB 编程:使用富文本编辑器 Quill 配合 WebBroker 后端
前端·后端·delphi·web开发·webbroker
aroc_lo5 个月前
DELPHI编译软件时带上当前IDE的版本号
ide·delphi