使TEdit 居中,继承!!!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TMyEdit=class(TEDit)
private
{ Private declarations }
public
{ Public declarations }
procedure CreateParams(var Params: TCreateParams);
override;
end;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
var
MyEDit:TMyEDit;
procedure TForm1.FormCreate(Sender: TObject);
begin
MyEDit:=TMyEDit.Create(self);
MyEdit.parent:=self;
end;
{ TMyEdit }
procedure TMyEdit.CreateParams(var Params: TCreateParams);
begin
inherited;
with paramsdo
Style:=(Style or ES_CENTER) and not (ES_RIGHT or ES_left );
end;
end.