{** * µ¥Ôª£ºFloatEdit * ×÷ÕߣºÍøÊÂÈç·ç * ×÷Ó㺿ÉÒÔÉèÖöÔÆ뷽ʽµÄEdit * ʹÓ㺠**} unit RightEdit; interface uses Windows, Messages, SysUtils, Classes, Controls, StdCtrls; type TRightEdit = class(TEdit) private FAlignment : TAlignment; //¶ÔÆ뷽ʽ procedure SetAlignment(Value: TAlignment); protected procedure CreateParams(var Params: TCreateParams); override; public { Public declarations } published property Alignment: TAlignment read FAlignment write SetAlignment; end; procedure Register; implementation procedure Register; begin RegisterComponents('MyCompent', [TRightEdit]); end; procedure TRightEdit.CreateParams(var Params: TCreateParams); begin inherited CreateParams(Params); Case FAlignment of taLeftJustify : Params.Style := Params.Style + ES_LEFT; taRightJustify : Params.Style := Params.Style + ES_RIGHT; taCenter : Params.Style := Params.Style + ES_CENTER; end; end; procedure TRightEdit.SetAlignment(Value: TAlignment); begin if FAlignment <> Value then begin FAlignment := Value; RecreateWnd; end; end; end. |