type
  TMyButton = class(TButton)
  published
    property Size: Integer read FSize write SetSize;
    procedure DoSomething;
  private
    FSize: Integer;
    procedure SetSize(const Value: Integer);
  end;{ TMyButton }procedure TMyButton.DoSomething;
beginend;procedure TMyButton.SetSize(const Value: Integer);
begin
  FSize := Value;
end;
这个是帮助里的标准程序,可是就是在
property Size: Integer read FSize write SetSize;这句上弹出
Field or method identifier expected错误,
再想问各位高手,Delphi的高手写Delphi常用这种类型定义吗?

解决方案 »

  1.   

    因为你的SetSize定义在后面,所以……换成下面的代码就好了。
    ==================================
    type
      TMyButton = class(TButton)
      private
        FSize: Integer;
        procedure SetSize(const Value: Integer);
      published
        property Size: Integer read FSize write SetSize;
        procedure DoSomething;
      end;{ TMyButton }procedure TMyButton.DoSomething;
    beginend;procedure TMyButton.SetSize(const Value: Integer);
    begin
      FSize := Value;
    end;