【问题标题】:'Property Align does not exist' when inheriting from TCustomControl从 TCustomControl 继承时“属性对齐不存在”
【发布时间】:2013-05-27 05:01:54
【问题描述】:

我创建了一个继承自TCustomControl 的自定义控件,并发布了TControl 的属性Align。但是,当我在 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.

【问题讨论】:

  • 你检查过 TCustomControl 实际上引用了正确的 Vcl.Controls.TCustomControl 吗?
  • @PeterVonča 是的,它引用了 Vcl.Controls.TCustomControl。

标签: delphi c++builder delphi-2009


【解决方案1】:

如果包没有正确重建,通常会发生这种错误。然后您需要打开包含单元“GameListCtrl”的包项目并重建包。确保激活让 RAD Studio 创建 C++ Builder 文件的选项。

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

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

【讨论】:

  • 删除所有包文件并重建后。它现在起作用了。谢谢。
猜你喜欢
  • 2021-03-19
  • 1970-01-01
  • 2014-02-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-02-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多