⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fmmain.pas

📁 这是不可多得的源代码
💻 PAS
字号:
unit fmMain;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    function CreateControl(classref : TControlClass; const cName : String;
                           const X, Y, W, H : Integer) : TControl;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

function TForm1.CreateControl(classref: TControlClass;
  const cName: String; const X, Y, W, H: Integer): TControl;
begin
  Result := classref.Create(Self);
  Result.Name := cName;
  Result.Parent := Self;
  Result.Left := X;
  Result.Top := Y;
  Result.Width := W;
  Result.Height := H;
  Result.Visible := True;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  CreateControl(TEdit, 'TEdit1', 10, 10, 100, 30);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  CreateControl(TButton, 'TButton1', 150, 10, 100, 30);
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  CreateControl(TListBox, 'TListBox1', 50, 80, 200, 200);
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  CreateControl(TMemo, 'TMemo1', 350, 80, 200, 200);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -