CnPack Forum


 
Subject: To yygw:将控件和事件从published改为private的方法
dark_moon
新警察
Rank: 1



UID 665
Digest Posts 1
Credits 29
Posts 9
点点分 29
Reading Access 10
Registered 2005-1-26
Status Offline
Post at 2005-1-26 13:07  Profile | Blog | P.M. 
To yygw:将控件和事件从published改为private的方法

代码如下:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
  private
    btn1: TButton;
  private
    procedure btn1Click(Sender : TObject);
  public
    constructor Create(AOwner : TComponent);override;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

{ TForm1 }

procedure TForm1.btn1Click(Sender: TObject);
begin
  //DoSomething();
end;

constructor TForm1.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  btn1 := FindComponent('btn1') as TButton;
  btn1.OnClick := btn1Click;
end;

initialization
  RegisterClass(TButton);
end.
Top
 




All times are GMT++8, the time now is 2024-3-4 12:22

    本论坛支付平台由支付宝提供
携手打造安全诚信的交易社区 Powered by Discuz! 5.0.0  © 2001-2006 Comsenz Inc.
Processed in 0.007094 second(s), 9 queries , Gzip enabled

Clear Cookies - Contact Us - CnPack Website - Archiver - WAP