从TCustomControl继承时,"属性对齐不存在"

Ult*_*pon 7 delphi c++builder delphi-2009

我创建了一个继承自TCustomControl并发布其属性Align的自定义控件TControl.但是,当我在C++ Builder项目中使用此自定义控件时,它引发了异常

Project Launcher.exe raised exception class EReadError with message 'Property Align does not exist'.

这是自定义控件的代码.

unit GameListCtrl;

interface

uses
  SysUtils, Classes, Controls;

type
  TGameList = class(TCustomControl)
  private
  protected
    procedure Paint; override;
  public
    { Public declarations }
  published
    property Align default alLeft;
  end;

implementation

{ TGameList }

procedure TGameList.Paint;
begin
  inherited;
end;

end.
Run Code Online (Sandbox Code Playgroud)

Joa*_*der 11

如果未正确重建包,通常会发生此类错误.然后你需要打开包含单元"GameListCtrl"的包项目,重建包.确保激活选项以让RAD Studio创建C++ Builder文件.

如果这没有帮助,链接器可能会选择错误的/旧的DCU或obj文件.搜索所有驱动器并删除您可以找到的所有GameListCtrl.dcu和GameListCtrl.obj文件.我使用JAM Software的UltraSearch快速搜索我的本地驱动器,它比Windows Search快得多,因为它直接在NTFS结构上工作.

您也可以尝试在项目选项中切换到项目的静态链接.