我想知道是否有办法在Delphi Pascal中为已存在/包含的类组件添加自定义方法. 我想用它来像这样旋转StringGrid: StringGridn.rotate(angle); 代替: rotate(StringGridn, angle); 谢谢你的建议 :) 您可以
我想用它来像这样旋转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);
