delphi - TButton 未声明的标识符

标签 delphi

以下代码是 Delphi 自行编写的,会引发错误

undeclared identifier TButton

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin

end;

end.

既然它使用了所需的所有单位,为什么它会抛出错误?

最佳答案

TButton 是在 Vcl.StdCtrls 中定义的,但使用单元列表中缺少它。通常,当您保存项目时,IDE 会将缺少的单元添加到列表中。

关于delphi - TButton 未声明的标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34835944/

相关文章:

delphi - 根据主记录值在 TCXGrid 中隐藏 TcxGridLevel

delphi - 绕过(禁用)Delphi 的接口(interface)引用计数

delphi - THTTPRIO 的默认超时值是多少

delphi - 是否可以在一种 FMX 表单上使用不同的 Delphi 版本?

delphi - 为什么创建 64 位 Delphi 这么难?

Delphi 和 Indy - 如何从 IdTCPServer 发送某些内容到特定的 IdTCPClient

delphi - 在接口(interface)定义中使用相同的 GUID 有危险吗?

Delphi 字符串生成器

sql-server - 获取存储过程的进度

c++ - 统一码灾难! Ms-Access 97 迁移到 Ms-Access 2007