我试了怎么是好的,我用的是delphi 6.0

解决方案 »

  1.   

    要在FormShow事件里写这行代码
      

  2.   

    设断点调试看看,是不是某个地方button1.enabled:= true;
      

  3.   

    会不好使?
    unit Unit1;
    interface
    uses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls;
    type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    var
      Form1: TForm1;
    implementation
    {$R *.DFM}
    procedure TForm1.FormCreate(Sender: TObject);
    begin
     self.Button1.Enabled:=false;
    end;end.
      

  4.   

    估计在formcreate的过程中还没有生成这个按钮
    要到formpaint的才会画出这个按钮时才生成这个按钮
    那时设置才有效
      

  5.   

    要是我做的话还是在form1.show事件里写。不管怎样。百分百安全,好使,没能创建不创建的烦恼!祝:身体健康!
      

  6.   

    请出示您的源代码,如果是这样,应该没有问题哦。
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    begin
      button1.enabled:= false;
    end;end.