joe85231 发表于 2011-3-30 08:50:39

delphi如何修改窗体的类名呢?

比如说窗体的类名是TForm1我怎么样才能修改呢?
哪位大大能举个例子么?

无限感觉 发表于 2011-3-30 08:50:51

重载createparam就行了

unit Unit1;

interface

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

type
TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
private
    procedure CreateParams(var Parames:TCreateParams);override;
public
    { Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
var
Name:array of char;
begin
GetClassName(Handle,Name,255);
ShowMessage(Name);
end;

procedure TForm1.CreateParams(var Parames: TCreateParams);
begin
inherited CreateParams(Parames);
Parames.WinClassName:='your class name';
end;

end.
页: [1]
查看完整版本: delphi如何修改窗体的类名呢?