private
FAlignment : TAlignment;
procedure SetAlignment(const Value: TAlignment);
protected
procedure CreateParams(var Params: TCreateParams); override;
published
property Alignment : TAlignment read FAlignment write SetAlignment default taLeftJustify;
....
procedure TStarEdit.SetAlignment(const Value: TAlignment);
begin
if FAlignment <> Value then
begin
FAlignment := Value;
RecreateWnd;
end;
end;
procedure TStarEdit.CreateParams(var Params: TCreateParams);
const
Alignments: array[Boolean, TAlignment] of DWORD =
((ES_LEFT, ES_RIGHT, ES_CENTER), (ES_RIGHT, ES_LEFT, ES_CENTER));
begin
inherited CreateParams(Params);
with Params do Style := Style or Alignments[UseRightToLeftAlignment, FAlignment];
end;
这是我改的控件里的部分代码,你参考一下