Einzelnen Beitrag anzeigen

uwewo

Registriert seit: 14. Jul 2004
Ort: Karlsruhe
479 Beiträge
 
Delphi 2006 Professional
 
#6

Re: vertikales Zentrieren in abgeleiteter Edit-Kompo

  Alt 26. Mär 2007, 13:44
Delphi-Quellcode:
private
   FAlignment : TAlignment;
   procedure SetAlignment(Value: TAlignment);
...
public
   procedure CreateParams(var Params: TCreateParams); Override;
...
published
   property Alignment: TAlignment read FAlignment write SetAlignment default taRightJustify;
...
end;

procedure TDeinEdit.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  if Parent <> nil then
   case FAlignment of
     taLeftJustify : Params.Style := Params.Style or ES_LEFT;
     taRightJustify : Params.Style := Params.Style or ES_RIGHT;
     taCenter : Params.Style := Params.Style or ES_CENTER;
   end;
end;

procedure TDeinEdit.SetAlignment(Value: TAlignment);
begin
  if FAlignment <> Value then
  begin
    FAlignment := Value;
    ReCreateWnd;
  end;
end;
Eine Möglichkeit
Uwe
  Mit Zitat antworten Zitat