加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

在Delphi pascal中使用自己的方法扩展库类

发布时间:2020-12-15 09:07:59 所属栏目:大数据 来源:网络整理
导读:我想知道是否有办法在Delphi Pascal中为已存在/包含的类组件添加自定义方法. 我想用它来像这样旋转StringGrid: StringGridn.rotate(angle); 代替: rotate(StringGridn,angle); 谢谢你的建议 :) 解决方法 您可以使用下面示例中的帮助程序,请参阅 Class and
我想知道是否有办法在Delphi Pascal中为已存在/包含的类组件添加自定义方法.

我想用它来像这样旋转StringGrid:

StringGridn.rotate(angle);

代替:

rotate(StringGridn,angle);

谢谢你的建议 :)

解决方法

您可以使用下面示例中的帮助程序,请参阅 Class and Record Helpers (Delphi).

type  
  TStringGridHelper = class helper for TStringGrid
    procedure Rotate(Angle: Single);
  end;

procedure TStringGridHelper.Rotate(Angle: Single);
begin
  { your implementation }
  Rotate(Self,Angle);  
end;

然后打电话

StringGridn.Rotate(Angle);

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读