case AAlignment of
taLeftJustify: Left := Margins.X;
taRightJustify: Left := ClientWidth - TextWidth(S) - Margins.X - 1;
else
Left := (ClientWidth - TextWidth(S)) div 2;
end;
if SysLocale.MiddleEast then UpdateTextFlags;
TextRect(R, Left, Margins.Y, S);
继承TEdit,重载CreateParams,修改Param即可。
procedure TEdit_Ex.CreateParams(var Params: TCreateParams);
begin
inherited;
if self.FTextOnRight then Params.Style:=Params.Style or ES_RIGHT;
end;